1. If friends system is not mutual 2 records are needed. 2. Even for mutual system "OR" in query is more expensive then 3-int row in DB.
On Aug 28, 9:45 am, Miles J <mileswjohn...@gmail.com> wrote: > @DigitalDude - Yes thats correct. > > @Pablo - No its not, it doesn't make a difference in overhead at all. > Also by inserting 2 rows your causing overhead and unneeded rows in > the database. > > Heres an example of one of my methods in my Friend model. > > /** > * Checks to see if two users are friends > * @param int $user_id > * @param int $friend_id > * @return boolean > */ > function isFriend($user_id, $friend_id) { > $status = $this->find('first', array( > 'fields' => 'Friend.status', > 'recursive' => -1, > 'conditions' => array( > 'OR' => array( > array('Friend.user_id' => $user_id, > 'Friend.friend_id' => > $friend_id), > array('Friend.user_id' => $friend_id, > 'Friend.friend_id' => > $user_id) > ) > ) > )); > > return $status['Friend']['status']; > > > > } --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---