Saturday, August 27, 2011

Re: CakePHP 2 - HABTM saving issue

Figured it out myself... maybe I should give myself a 24-hour rule from the time I write my post to the time I actually post it :)

Anyway, to get model deleting to work I set the 'dependent' property to True in the User model's hasMany relationship for AuthSourcesUser, and my array to save it looks like this:
Array (     [User] => Array         (             [email] => (my email address)             [first_name] => Ben             [last_name] => McClure         )      [AuthSourcesUser] => Array         (             [0] => Array                 (                     [auth_source_id] => 1                     [unique_value] => (my unique value)                 )          )      [Role] => Array         (             [id] => 2         )  )
Success! Sweet, sweet success!

Ben

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
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

No comments: