/** * Returns a new PersonQuery object. * * @param string $modelAlias The alias of a model in the query * @param PersonQuery|Criteria $criteria Optional Criteria to build the query from * * @return PersonQuery */ public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof PersonQuery) { return $criteria; } $query = new PersonQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }
/** * Get the associated Person object * * @param PropelPDO $con Optional Connection object. * @param $doQuery Executes a query to get the object if required * @return Person The associated Person object. * @throws PropelException */ public function getPersonRelatedByPerson2(PropelPDO $con = null, $doQuery = true) { if ($this->aPersonRelatedByPerson2 === null && $this->person_2 !== null && $doQuery) { $this->aPersonRelatedByPerson2 = PersonQuery::create()->findPk($this->person_2, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aPersonRelatedByPerson2->addFriendsRelatedByPerson2($this); */ } return $this->aPersonRelatedByPerson2; }
/** * Returns the number of Equal Nest Friends of this object. * * @param Criteria $criteria * @param boolean $distinct * @param PropelPDO $con * @return integer Count of Friends * @throws PropelException */ public function countFriends(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { if (null === $this->listEqualNestFriendsPKs) { $this->initListFriendsPKs($con); } if (null === $this->collEqualNestFriends || null !== $criteria) { if ($this->isNew() && null === $this->collEqualNestFriends) { return 0; } else { $query = PersonQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query->addUsingAlias(PersonPeer::ID, $this->listEqualNestFriendsPKs, Criteria::IN)->count($con); } } else { return count($this->collEqualNestFriends); } }