Ejemplo n.º 1
0
 /**
  * Follow something [collection, member, goup]
  *
  * @param   integer  $id             ID of the thing being followed
  * @param   string   $what           What's being followed
  * @param   integer  $follower_id    ID of the follower
  * @param   string   $follower_type  Type of the follower [member, group]
  * @return  boolean
  */
 public function follow($id, $what = 'collection', $follower_id = 0, $follower_type = 'member')
 {
     $follow = new Following($id, $what, $follower_id, $follower_type);
     if (!$follow->exists()) {
         $follow->bind(array('following_id' => $id, 'following_type' => $what, 'follower_id' => $follower_id, 'follower_type' => $follower_type));
         if (!$follow->store(true)) {
             $this->setError($follow->getError());
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  * Follow this collection
  *
  * @param   integer  $follower_id    ID of the follower
  * @param   string   $follower_type  Type of the follower [member, group]
  * @return  boolean
  */
 public function follow($follower_id = null, $follower_type = 'member')
 {
     $follow = new Following();
     $follow->bind(array('following_id' => $this->get('id'), 'following_type' => 'collection', 'follower_id' => $follower_id, 'follower_type' => $follower_type));
     if (!$follow->store(true)) {
         $this->setError($follow->getError());
         return false;
     }
     return true;
 }