public static function doSelectJoinAllExceptUser(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } UserfriendPeer::addSelectColumns($c); $startcol2 = UserfriendPeer::NUM_COLUMNS - UserfriendPeer::NUM_LAZY_LOAD_COLUMNS + 1; FriendPeer::addSelectColumns($c); $startcol3 = $startcol2 + FriendPeer::NUM_COLUMNS; $c->addJoin(UserfriendPeer::FRIEND_ID, FriendPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = UserfriendPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = FriendPeer::getOMClass(); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol2); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj2 = $temp_obj1->getFriend(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addUserfriend($obj1); break; } } if ($newObject) { $obj2->initUserfriends(); $obj2->addUserfriend($obj1); } $results[] = $obj1; } return $results; }
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(FriendPeer::ID, $pks, Criteria::IN); $objs = FriendPeer::doSelect($criteria, $con); } return $objs; }
?> have not specified email"> <?php } ?> <?php $c = new Criteria(); $c->addJoin(UserfriendPeer::FRIEND_ID, FriendPeer::ID); $c->add(UserfriendPeer::USER_ID, $myid); $c->add(FriendPeer::USER_ID, $rs->getId()); $isMyReq = FriendPeer::doSelectOne($c); $c = new Criteria(); $c->addJoin(UserfriendPeer::FRIEND_ID, FriendPeer::ID); $c->add(UserfriendPeer::USER_ID, $rs->getId()); $c->add(FriendPeer::USER_ID, $myid); $isOthReq = FriendPeer::doSelectOne($c); ?> <?php if ($isMyReq) { ?> <img src="/images/prvfriendsGray.gif" alt="Mark friend" title="<?php echo "You have already marked " . $rs->getFullname() . " as a friend."; ?> "> <?php } else { ?> <a href="/friend/add/id/<?php echo $rs->getId(); ?> .html"><img src="/images/prvfriends.gif" alt="add friend" title="<?php
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = FriendPeer::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->setStatus($arr[$keys[2]]); } }
public function getFriend($con = null) { include_once 'lib/model/om/BaseFriendPeer.php'; if ($this->aFriend === null && $this->friend_id !== null) { $this->aFriend = FriendPeer::retrieveByPK($this->friend_id, $con); } return $this->aFriend; }
public function countFriends($criteria = null, $distinct = false, $con = null) { include_once 'lib/model/om/BaseFriendPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(FriendPeer::USER_ID, $this->getId()); return FriendPeer::doCount($criteria, $distinct, $con); }