public function executeListStatus() { $c = new Criteria(); $c->add(JobPeer::CODE, 'pmb_menu/listStatus'); $job = JobPeer::doSelectOne($c); $cw = new Criteria(); $cw->add(JobInformationPeer::JOB_ID, $job->getId()); $job_information = JobInformationPeer::doSelectOne($cw); $public_information = PublicInformationPeer::retrieveByPk($job_information->getPublicInformationId()); $job_category = JobCategoryPeer::retrieveByPk($job_information->getJobCategoryId()); $this->job = $job; $this->job_information = $job_information; $this->job_category = $job_category; $this->public_information = $public_information; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = JobCategoryPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setCode($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setName($arr[$keys[2]]); } }
public function filter($c, $filters) { $filters_key = array_keys($filters); foreach ($filters_key as $key) { $value = $filters[$key]; if ($value == '' || $value == null) { continue; } if ($key == 'PUBLIC_INFORMATION_ID') { $c->addJoin(JobInformationPeer::JOB_ID, JobPeer::ID); $c->addJoin(PublicInformationPeer::ID, JobInformationPeer::PUBLIC_INFORMATION_ID); $column = PublicInformationPeer::getTableMap()->getColumn('ID'); } elseif ($key == 'JOB_CATEGORY_ID') { $c->addJoin(JobInformationPeer::JOB_ID, JobPeer::ID); $c->addJoin(JobCategoryPeer::ID, JobInformationPeer::JOB_CATEGORY_ID); $column = JobCategoryPeer::getTableMap()->getColumn('ID'); } else { $column = JobPeer::getTableMap()->getColumn($key); } $name = $column->getFullyQualifiedName(); $creoleType = $column->getCreoleType(); if ($creoleType == CreoleTypes::TIMESTAMP) { $c->add($name, $value, Criteria::EQUAL); } else { if ($creoleType == CreoleTypes::INTEGER) { $c->add($name, $value, Criteria::EQUAL); } else { if ($creoleType == CreoleTypes::VARCHAR) { $c->add($name, "%{$value}%", Criteria::LIKE); } else { if ($creoleType == CreoleTypes::CHAR) { $c->add($name, "%{$value}%", Criteria::LIKE); } } } } } }
public static function doSelectJoinAllExceptPublicInformation(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } JobInformationPeer::addSelectColumns($c); $startcol2 = JobInformationPeer::NUM_COLUMNS - JobInformationPeer::NUM_LAZY_LOAD_COLUMNS + 1; JobPeer::addSelectColumns($c); $startcol3 = $startcol2 + JobPeer::NUM_COLUMNS; JobCategoryPeer::addSelectColumns($c); $startcol4 = $startcol3 + JobCategoryPeer::NUM_COLUMNS; $c->addJoin(JobInformationPeer::JOB_ID, JobPeer::ID); $c->addJoin(JobInformationPeer::JOB_CATEGORY_ID, JobCategoryPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = JobInformationPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = JobPeer::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->getJob(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addJobInformation($obj1); break; } } if ($newObject) { $obj2->initJobInformations(); $obj2->addJobInformation($obj1); } $omClass = JobCategoryPeer::getOMClass(); $cls = Propel::import($omClass); $obj3 = new $cls(); $obj3->hydrate($rs, $startcol3); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj3 = $temp_obj1->getJobCategory(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addJobInformation($obj1); break; } } if ($newObject) { $obj3->initJobInformations(); $obj3->addJobInformation($obj1); } $results[] = $obj1; } return $results; }
public function getJobCategory($con = null) { include_once 'lib/model/om/BaseJobCategoryPeer.php'; if ($this->aJobCategory === null && $this->job_category_id !== null) { $this->aJobCategory = JobCategoryPeer::retrieveByPK($this->job_category_id, $con); } return $this->aJobCategory; }
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(JobCategoryPeer::ID, $pks, Criteria::IN); $objs = JobCategoryPeer::doSelect($criteria, $con); } return $objs; }
public function executeDelete() { $job_category = JobCategoryPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($job_category); $ref_error = 0; foreach ($job_category->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $job_category->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('job_category/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('job_category/delete', '_ERR_DELETE_ (' . $job_category->toString() . ' - id:' . $job_category->getId() . ')'); } else { $job_category->delete(); } return $this->forward('job_category', 'list'); }