public function getDistricts($criteria = null, $con = null) { include_once 'lib/model/om/BaseDistrictPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collDistricts === null) { if ($this->isNew()) { $this->collDistricts = array(); } else { $criteria->add(DistrictPeer::CITY_ID, $this->getId()); DistrictPeer::addSelectColumns($criteria); $this->collDistricts = DistrictPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(DistrictPeer::CITY_ID, $this->getId()); DistrictPeer::addSelectColumns($criteria); if (!isset($this->lastDistrictCriteria) || !$this->lastDistrictCriteria->equals($criteria)) { $this->collDistricts = DistrictPeer::doSelect($criteria, $con); } } } $this->lastDistrictCriteria = $criteria; return $this->collDistricts; }
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(DistrictPeer::ID, $pks, Criteria::IN); $objs = DistrictPeer::doSelect($criteria, $con); } return $objs; }