Hi I have two database tables.
Table A has many Table B's . Table B's belong to Table A. This relationship is defined in the databases real foreign keys. This relationship is defined in ORM using virtual foreign keys.
In the Model for Table A I have defined:
$this->hasMany("id", "TableB", "table_a_id", array(
"foreignKey" => array(
"action" => Relation::ACTION_CASCADE,
"message" => "Cannot delete table a as it still contains table b's"
)
));
When I attempt to tableA->delete() it fails because of an integrity contraint defined in the database. The integrity constraint it fails on is:
Name Schema Table Column Ref-Table Ref Column
table_a_fk my_schema table_b table_a_id table_a id
Can anyone confirm that:
You can only delete a parent record that has a relation cascade on its children providing you do not have real foreign keys defined in the database?
Many Thanks.