예제 #1
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      UserFb $value A UserFb object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(UserFb $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getUserid();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
예제 #2
0
 public function executeFacebookadd($request)
 {
     $username = $request->getParameter('username');
     if ($username == '') {
         return sfView::ERROR;
     }
     $fbUserJSON = @file_get_contents('http://graph.facebook.com/' . $username);
     if (!$fbUserJSON) {
         return sfView::ERROR;
     }
     $fbUser = json_decode($fbUserJSON, true);
     if (!is_array($fbUser) || !isset($fbUser['id'])) {
         return sfView::ERROR;
     }
     /* @var $user User */
     $user = $this->getUser()->getRaykuUser();
     $userFb = $user->getUserFb();
     if (!$userFb) {
         $userFb = new UserFb();
         $userFb->setUser($user);
     }
     $userFb->setFbUsername($username);
     $userFb->setFbUid($fbUser['id']);
     $userFb->save();
     $this->weAreFriendsNow = $request->getGetParameter('action');
     if ($this->weAreFriendsNow) {
         /**
          * @todo - accept new friend on RaykuBot FB profile
          */
         BotServiceProvider::createFor(sfConfig::get('app_facebook_url') . "/queue_friendship_worker")->getContent();
     }
 }
예제 #3
0
파일: BaseUser.php 프로젝트: rayku/rayku
 /**
  * Sets a single UserFb object as related to this object by a one-to-one relationship.
  *
  * @param      UserFb $l UserFb
  * @return     User The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setUserFb(UserFb $v)
 {
     $this->singleUserFb = $v;
     // Make sure that that the passed-in UserFb isn't already associated with this object
     if ($v->getUser() === null) {
         $v->setUser($this);
     }
     return $this;
 }