Tuesday, April 28, 2009

Re: dependent has no effect with delete()

Solved. I just noticed that ItemFile::beforeDelete() did not return true;

On Tue, Apr 28, 2009 at 5:01 PM, brian <bally.zijn@gmail.com> wrote:
> I'm using $this->Item->del($id, true) in ItemsController. I expect
> that its ItemFiles would also be deleted but they are not. I've
> compared my models with the examples in the book several times and
> plodded through the source and I've no idea what the problem is.
> Anyone else think of something?
>
> class Item extends AppModel
> {
>        public $hasMany = array(
>                'ItemFile' => array(
>                        'className' => 'ItemFile',
>                        'foreignKey' => 'item_id',
>                        'dependent' => true
>                )
>        );
> }
>
> class ItemFile extends AppModel
> {
>        public $belongsTo = array(
>                'Item' => array(
>                        'className' => 'Item',
>                        'foreignKey' => 'item_id'
>                )
>        );
> }
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: