Hi Dave. If your Post and User models both have a HABTM relationship to Bookmark, then you can use the ** "unique" => true ** parameter in the association.
This means that if it does find a duplicate record, it will override it. I hope this helps. On Apr 11, 6:11 pm, "Dave Maharaj :: WidePixels.com" <[email protected]> wrote: > I am trying to query a table to determine if the record exists as I do not > want duplicates but not sure if this is correct. > > $results = $this->find('first', array('conditions' => > array('Bookmark.user_id' => $user_id, 'Bookmark.post_id' => $post_id))); > debug($results); > > so if the user_id and the post_id are in the same row then do not save the > bookmark because it already exists. > > Is this right? > > Dave --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
