Exemplo n.º 1
0
 public static function createFollower($service, array $rawfollower, PropelPDO $con = null)
 {
     $crit = new Criteria();
     $crit->add(self::SENDER_ID, $rawfollower['id']);
     $follower = self::doSelectOne($crit, $con);
     if (is_null($follower)) {
         if (!$service->existsFriendship(sfConfig::get('twitter_user_id'), $rawfollower['id'])) {
             $service->createFriendship($rawfollower['id']);
         }
         $follower = new Follower();
         $follower->setFollowing(true);
         $follower->setSenderId($rawfollower['id']);
         $follower->setSenderName($rawfollower['name']);
         $follower->setSenderScreenName($rawfollower['screen_name']);
         $follower->setSenderLocation($rawfollower['location']);
         $follower->setSenderProfileImg($rawfollower['profile_image_url']);
         $follower->setSenderProtected($rawfollower['protected']);
         $follower->save();
     }
     return $follower;
 }