Thanks for the software. It really helps! Great job.
I have a connection with many models. All with relation: belongsTo and associated with the main model so I left the Accociated Model empty. Beside these I have the foreign key and primary key set for each model. It works with displaying the data in views.
I set the Associative delete to Yes. I added the _DELETE_ action into the list page.
I can see the data from the main model is deleted correctly from the database. However, all the associated models data is untouched by the Delete action.
Am I missing something in my settings?
I have a connection with many models. All with relation: belongsTo and associated with the main model so I left the Accociated Model empty. Beside these I have the foreign key and primary key set for each model. It works with displaying the data in views.
I set the Associative delete to Yes. I added the _DELETE_ action into the list page.
I can see the data from the main model is deleted correctly from the database. However, all the associated models data is untouched by the Delete action.
Am I missing something in my settings?
Hi Szczypka,
Deleting the primary model will delete all children models records, IF the relation is "hasOne" or "hasMany", but not if its belongsTo.
Regards,
Max
Deleting the primary model will delete all children models records, IF the relation is "hasOne" or "hasMany", but not if its belongsTo.
Regards,
Max
Thanks Max,
I understand.
with the 'belongsTo' I set only the Foreign key and Primary key fields and I'm able to access all fields that I need. However when I simply changed the Relation to 'hasOne' I get nothing.
Is there a different way to configure the models when working with 'hasOne' relationship?
I understand.
with the 'belongsTo' I set only the Foreign key and Primary key fields and I'm able to access all fields that I need. However when I simply changed the Relation to 'hasOne' I get nothing.
Is there a different way to configure the models when working with 'hasOne' relationship?
The relation depends on the real relation between the 2 tables, so in some cases you can only set it up as "belongsTo", in case the main table is the "slave" table.
More info here, the slave table is the one which has the "foreign key", and the framework is built so that deleting a record from the salve table should not delete a record from the master table, only the opposite way works.
So if you want to delete the master table's record then you need PHP code to do that OR you need to change the relation between the 2 tables.
Regards,
Max
So if you want to delete the master table's record then you need PHP code to do that OR you need to change the relation between the 2 tables.
Regards,
Max
This topic is locked and no more replies can be posted.
