Or perhaps the big 'afterSave()' function could be better written as
function afterSave() {
// ----!! PSUDO CODE !! -----
// check to see if the 'mirrored' version already exists
$alt_friendship = $this->find('all',arrray('conditions' => array ('user_id = ? AND friend_id = ?',$this->friend_id,$this->user_id)))
// if it does, abort the function
if(!empty($alt_friendship)) return true;
// else we create (which means create and save)
$this->create(array('friend_id' => $this->user_id, 'user_id' => $this->'friend_id'));
}
1 to 3 of 3