/** * Filter the query by a related Friend object * * @param Friend|PropelObjectCollection $friend the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return PersonQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByFriendRelatedByPerson2($friend, $comparison = null) { if ($friend instanceof Friend) { return $this->addUsingAlias(PersonPeer::ID, $friend->getPerson2(), $comparison); } elseif ($friend instanceof PropelObjectCollection) { return $this->useFriendRelatedByPerson2Query()->filterByPrimaryKeys($friend->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByFriendRelatedByPerson2() only accepts arguments of type Friend or PropelCollection'); } }
/** * Builds a new equal nest relation between Person objects * * @param Person|integer $object1 * @param Person|integer $object2 * @param PropelPDO $con */ public static function buildEqualNestFriendRelation($object1, $object2, PropelPDO $con = null) { if (self::checkForExistingEqualNestFriendRelation($object1, $object2, $con)) { return; } $aFriend = new Friend(); $aFriend->setPerson1(is_object($object1) ? $object1->getPrimaryKey() : $object1); $aFriend->setPerson2(is_object($object2) ? $object2->getPrimaryKey() : $object2); $aFriend->save(); }
/** * Exclude object from result * * @param Friend $friend Object to remove from the list of results * * @return FriendQuery The current query, for fluid interface */ public function prune($friend = null) { if ($friend) { $this->addCond('pruneCond0', $this->getAliasedColName(FriendPeer::PERSON_1), $friend->getPerson1(), Criteria::NOT_EQUAL); $this->addCond('pruneCond1', $this->getAliasedColName(FriendPeer::PERSON_2), $friend->getPerson2(), Criteria::NOT_EQUAL); $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); } return $this; }