Wow - so I feel dumb about that mistake! I updated my code and it is
working now. I was going crazy trying to figure that out!
Now I'm having an issue where bindings that are established in the
model are recursively deleting, but bindings I set on the fly in the
controller are not deleting. Here's the code from my controller:
$this->Account->bindModel(array('hasMany' => array(
'Update' => array('dependent' => true, 'exclusive' =>
true),
'Feed' => array('dependent' => true, 'exclusive' =>
true)
)));
$this->Account->delete($id);
The Searchfeed, Author, and Rule models are recursively deleting based
on my model code from above (with the spelling error fixed) but the
Update and Feed models are not deleting.
Is there some trick for getting on-the-fly bindings to work with
recursive deletion?
Thanks!
- Jason
On May 11, 3:00 am, schneimi <[email protected]> wrote:
> Hi,
>
> just a misspelling, try 'dependent' instead of 'dependant' ;-)
>
> Michael
>
> Jason schrieb:
>
> > I can't figure out what I'm doing wrong here. I'm fairly new to
> > CakePHP and have been having a lot of success getting a new app set
> > up, but I'm running up against a brick wall trying to getrecursive
> >deleteworking.
>
> > Here is my Account model:
>
> > class Account extends AppModel {
> > var $hasMany = array(
> > 'Searchfeed' => array(
> > 'order' => 'Searchfeed.created DESC',
> > 'dependant' => true,
> > 'exclusive' => true
> > ),
> > 'Author' => array(
> > 'order' => 'Author.created DESC',
> > 'dependant' => true,
> > 'exclusive' => true
> > ),
> > 'Rule' => array(
> > 'order' => 'Rule.created DESC',
> > 'dependant' => true,
> > 'exclusive' => true
> > ),
> > );
> > }
>
> > I am running this in the controller:
>
> > $this->Account->del($id);
>
> > Cake generates SQL todeletefrom the accounts table, but it does not
> > even attempt to touch the other tables that are dependent. I even
> > tried forcing the $cascade variable (which default to true) like this:
>
> > $this->Account->del($id, true);
>
> > But I get the same result. It only deletes from the primary model, not
> > from the dependent models. What am I doing wrong?
>
> > - Jason
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---