I Have a HABTM relationship.

Listing HABTM User
Listing belongsto User

   - User can create listings, so the lists are owned by them, but also can 
   assign those lists to another users.
   - Users have access to lists created by them, or assigned by their 
   parents.
   - The system is recursive. A user can assign a list to its children 
   users. So the children users can assign the same list assined to them to 
   its chieldren and so on.
   - 'unique' index in habtm is currently set to 'keepExisting'


The problem is, the listing edit form displays only available listings for 
current user, so as i'm using habtm and habtm erases the content of related 
table that is not submited by the form and the form does not display the 
lists assigned to another users, everytime a users submit and update to the 
listing, all other users lose access to this listing, even if this listing 
was assigned by another user or the user is not in the same user tree.

*The behaviour I was expecting was: The habtm delete the fields not checked 
in the form, but keep the fields not present in the form.*
*
*
I probably need to set it to true, so the values will be erased and merge 
the selected values in the form with the ones already present in the habtm 
association table 
(listings_users<http://localhost/phpmyadmin/sql.php?db=sms&token=f861bf51ec623afd93ee893192a20fb5&table=listings_users&pos=0>)
 
that i could retrieve with a find, but i couldnt figure out how to write 
that in a "cake" way.

*2.x Manual:*
unique: boolean or string keepExisting.
If true (default value) cake will first delete existing relationship 
records in the foreign keys table before inserting new ones. Existing 
associations need to be passed again when updating.
When false, cake will insert the relationship record, and that no join 
records are deleted during a save operation.
*When set to keepExisting, the behavior is similar to true, but existing 
associations are not deleted.*
*
*
PS: I created the model named listing, because list is a php reserved word.

-- 
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].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.


Reply via email to