public function getEmployeePhotos($criteria = null, $con = null) { include_once 'lib/model/om/BaseEmployeePhotoPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collEmployeePhotos === null) { if ($this->isNew()) { $this->collEmployeePhotos = array(); } else { $criteria->add(EmployeePhotoPeer::EMPLOYEE_ID, $this->getId()); EmployeePhotoPeer::addSelectColumns($criteria); $this->collEmployeePhotos = EmployeePhotoPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(EmployeePhotoPeer::EMPLOYEE_ID, $this->getId()); EmployeePhotoPeer::addSelectColumns($criteria); if (!isset($this->lastEmployeePhotoCriteria) || !$this->lastEmployeePhotoCriteria->equals($criteria)) { $this->collEmployeePhotos = EmployeePhotoPeer::doSelect($criteria, $con); } } } $this->lastEmployeePhotoCriteria = $criteria; return $this->collEmployeePhotos; }
public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } EmployeePhotoPeer::addSelectColumns($c); $startcol2 = EmployeePhotoPeer::NUM_COLUMNS - EmployeePhotoPeer::NUM_LAZY_LOAD_COLUMNS + 1; EmployeePeer::addSelectColumns($c); $startcol3 = $startcol2 + EmployeePeer::NUM_COLUMNS; $c->addJoin(EmployeePhotoPeer::EMPLOYEE_ID, EmployeePeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = EmployeePhotoPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = EmployeePeer::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->getEmployee(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addEmployeePhoto($obj1); break; } } if ($newObject) { $obj2->initEmployeePhotos(); $obj2->addEmployeePhoto($obj1); } $results[] = $obj1; } return $results; }