public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(UserfriendPeer::ID, $pks, Criteria::IN); $objs = UserfriendPeer::doSelect($criteria, $con); } return $objs; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = UserfriendPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setUserId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setFriendId($arr[$keys[2]]); } }
public function getUserfriendsJoinUser($criteria = null, $con = null) { include_once 'lib/model/om/BaseUserfriendPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collUserfriends === null) { if ($this->isNew()) { $this->collUserfriends = array(); } else { $criteria->add(UserfriendPeer::FRIEND_ID, $this->getId()); $this->collUserfriends = UserfriendPeer::doSelectJoinUser($criteria, $con); } } else { $criteria->add(UserfriendPeer::FRIEND_ID, $this->getId()); if (!isset($this->lastUserfriendCriteria) || !$this->lastUserfriendCriteria->equals($criteria)) { $this->collUserfriends = UserfriendPeer::doSelectJoinUser($criteria, $con); } } $this->lastUserfriendCriteria = $criteria; return $this->collUserfriends; }
public function executeReject() { $toid = $this->getRequestParameter('id'); $loggedid = $this->getUser()->getAttribute('userid'); $c = new Criteria(); $c->addJoin(UserfriendPeer::FRIEND_ID, FriendPeer::ID); $c->add(FriendPeer::USER_ID, $loggedid); $c->add(UserfriendPeer::USER_ID, $toid); $uf = UserfriendPeer::doSelectOne($c); $friend = $uf->getUser(); $uf->getFriend()->delete(); $uf->delete(); $this->setFlash('notice', '<font style="background-color: yellow">Now you are not following <b>' . $friend->getFullname() . '</b>.</font>'); $this->redirect('friend/followings?page=' . $this->getUser()->getAttribute('ifpage')); }