[eluser]mcnux[/eluser]
[quote author="OverZealous" date="1251467126"]Please give me the relationship arrays and the actual code you are writing. Thanks.[/quote]
Of course. I've trimmed what I actually do on a delete to as little as possible to make it clear where the issue lies. Have tested.
Code:
class List_item extends DataMapper{
var $has_one = array(
'list_item'=>array(
'other_field'=>'sub_item'
),
);
var $has_many = array(
'sub_item'=>array(
'class'=>'list_item'
)
);
}
$listItem = new List_item(1);
$listItem->delete(); // standard delete; haven't overridden in List_item
// results in
UPDATE `list_items` SET `sub_item_id` = NULL WHERE `sub_item_id` = 1
Where it's obviously trying to remove the sub_item relations before it deletes the list_item.