/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(PilotPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(PilotPeer::DATABASE_NAME); $criteria->add(PilotPeer::ID, $pks, Criteria::IN); $objs = PilotPeer::doSelect($criteria, $con); } return $objs; }
/** * Gets an array of Pilot objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this Pilot has previously been saved, it will retrieve * related PilotsRelatedByMopOrientedMemberId from storage. If this Pilot is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array Pilot[] * @throws PropelException */ public function getPilotsRelatedByMopOrientedMemberId($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(PilotPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collPilotsRelatedByMopOrientedMemberId === null) { if ($this->isNew()) { $this->collPilotsRelatedByMopOrientedMemberId = array(); } else { $criteria->add(PilotPeer::MOP_ORIENTED_MEMBER_ID, $this->id); PilotPeer::addSelectColumns($criteria); $this->collPilotsRelatedByMopOrientedMemberId = PilotPeer::doSelect($criteria, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(PilotPeer::MOP_ORIENTED_MEMBER_ID, $this->id); PilotPeer::addSelectColumns($criteria); if (!isset($this->lastPilotRelatedByMopOrientedMemberIdCriteria) || !$this->lastPilotRelatedByMopOrientedMemberIdCriteria->equals($criteria)) { $this->collPilotsRelatedByMopOrientedMemberId = PilotPeer::doSelect($criteria, $con); } } } $this->lastPilotRelatedByMopOrientedMemberIdCriteria = $criteria; return $this->collPilotsRelatedByMopOrientedMemberId; }
/** * Gets an array of Pilot objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this Airport has previously been saved, it will retrieve * related Pilots from storage. If this Airport is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array Pilot[] * @throws PropelException */ public function getPilots($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(AirportPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collPilots === null) { if ($this->isNew()) { $this->collPilots = array(); } else { $criteria->add(PilotPeer::PRIMARY_AIRPORT_ID, $this->id); PilotPeer::addSelectColumns($criteria); $this->collPilots = PilotPeer::doSelect($criteria, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(PilotPeer::PRIMARY_AIRPORT_ID, $this->id); PilotPeer::addSelectColumns($criteria); if (!isset($this->lastPilotCriteria) || !$this->lastPilotCriteria->equals($criteria)) { $this->collPilots = PilotPeer::doSelect($criteria, $con); } } } $this->lastPilotCriteria = $criteria; return $this->collPilots; }
public static function getNotInPilot() { $c = new Criteria(); $pliots = PilotPeer::doSelect($c); if ($pliots) { foreach ($pliots as $pliot) { $c->addJoin(self::ID, PilotPeer::MEMBER_ID, Criteria::LEFT_JOIN); $c->addJoin(self::PERSON_ID, PersonPeer::ID); $c->add(PilotPeer::MEMBER_ID, null, Criteria::ISNULL); $not_in_pilot_persons = PersonPeer::doSelect($c); } } else { $not_in_pilot_persons = PersonPeer::doSelect($c); } $arr = array(); $arr[0] = '-- select --'; foreach ($not_in_pilot_persons as $not_in_pilot_person) { $arr[$not_in_pilot_person->getId()] = $not_in_pilot_person->getLastName(); } return $arr; }