示例#1
0
 public function getEmployeeJobHistorysJoinStructuralJob($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseEmployeeJobHistoryPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collEmployeeJobHistorys === null) {
         if ($this->isNew()) {
             $this->collEmployeeJobHistorys = array();
         } else {
             $criteria->add(EmployeeJobHistoryPeer::FUNCTIONAL_JOB_ID, $this->getId());
             $this->collEmployeeJobHistorys = EmployeeJobHistoryPeer::doSelectJoinStructuralJob($criteria, $con);
         }
     } else {
         $criteria->add(EmployeeJobHistoryPeer::FUNCTIONAL_JOB_ID, $this->getId());
         if (!isset($this->lastEmployeeJobHistoryCriteria) || !$this->lastEmployeeJobHistoryCriteria->equals($criteria)) {
             $this->collEmployeeJobHistorys = EmployeeJobHistoryPeer::doSelectJoinStructuralJob($criteria, $con);
         }
     }
     $this->lastEmployeeJobHistoryCriteria = $criteria;
     return $this->collEmployeeJobHistorys;
 }
示例#2
0
 public function executeDelete()
 {
     $employee_job_history = EmployeeJobHistoryPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee_job_history);
     $employee_id = $employee_job_history->getEmployeeId();
     $ref_error = 0;
     foreach ($employee_job_history->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $employee_job_history->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('employee_job_history_o/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('employee_job_history_o/delete', '_ERR_DELETE_ (' . $employee_job_history->toString() . ' - id:' . $employee_job_history->getId() . ')');
     } else {
         $employee_job_history->delete();
     }
     return $this->redirect('employee_job_history_o/list');
 }
示例#3
0
 public function filterJob($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'EXTRA_CODE') {
             $c->addJoin(EmployeePeer::ID, EmployeeJobHistoryPeer::EMPLOYEE_ID);
             $c->addJoin(EmployeeDetailPeer::EMPLOYEE_ID, EmployeePeer::ID);
             $column = EmployeeDetailPeer::getTableMap()->getColumn('EXTRA_CODE');
         } elseif ($key == 'LEVEL') {
             $c->addJoin(EmployeeLevelPeer::ID, EmployeeJobHistoryPeer::EMPLOYEE_LEVEL_ID);
             $column = EmployeeLevelPeer::getTableMap()->getColumn('LEVEL');
         } elseif ($key == 'CODE') {
             $c->addJoin(EmployeePeer::ID, EmployeeJobHistoryPeer::EMPLOYEE_ID);
             $column = EmployeePeer::getTableMap()->getColumn('CODE');
         } elseif ($key == 'EMP_NAME') {
             $c->addJoin(EmployeePeer::ID, EmployeeJobHistoryPeer::EMPLOYEE_ID);
             $column = EmployeePeer::getTableMap()->getColumn('NAME');
         } else {
             $column = EmployeeJobHistoryPeer::getTableMap()->getColumn($key);
         }
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIMESTAMP) {
             $from = $value['from'];
             $to = $value['to'];
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
             }
             if ($to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } elseif ($creoleType == CreoleTypes::DATE) {
             $from = $value['from'];
             $to = $value['to'];
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
             }
             if ($to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::INTEGER) {
                 $c->add($name, $value, Criteria::EQUAL);
             } else {
                 if ($creoleType == CreoleTypes::VARCHAR || $creoleType == CreoleTypes::CHAR) {
                     $c->add($name, "%{$value}%", Criteria::LIKE);
                 }
             }
         }
     }
 }
 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(EmployeeJobHistoryPeer::ID, $pks, Criteria::IN);
         $objs = EmployeeJobHistoryPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
示例#5
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = EmployeeJobHistoryPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setEmployeeId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setStart($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setWorkServiceYear($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setWorkServiceMonth($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setDecree($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setStaffTypeId($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setStructuralJobId($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setFunctionalJobId($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setRank($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setDetail($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setDepartmentId($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setEmployeeLevelId($arr[$keys[12]]);
     }
 }