Esempio n. 1
0
 public function executeDelete()
 {
     $student_job_history = StudentJobHistoryPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($student_job_history);
     $student_id = $student_job_history->getStudentId();
     $ref_error = 0;
     foreach ($student_job_history->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $student_job_history->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('student_job_history/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('student_job_history/delete', '_ERR_DELETE_ (' . $student_job_history->toString() . ' - id:' . $student_job_history->getId() . ')');
     } else {
         $student_job_history->delete();
     }
     return $this->redirect('student_job_history/list?student_id=' . $student_id);
 }
Esempio n. 2
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = StudentJobHistoryPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setStudentId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setAcademicCalendarId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setInstanceId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setStart($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setEnd($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setGrade($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setCitationId($arr[$keys[7]]);
     }
 }
Esempio n. 3
0
 public function getStudentJobHistorysJoinCitation($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseStudentJobHistoryPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collStudentJobHistorys === null) {
         if ($this->isNew()) {
             $this->collStudentJobHistorys = array();
         } else {
             $criteria->add(StudentJobHistoryPeer::ACADEMIC_CALENDAR_ID, $this->getId());
             $this->collStudentJobHistorys = StudentJobHistoryPeer::doSelectJoinCitation($criteria, $con);
         }
     } else {
         $criteria->add(StudentJobHistoryPeer::ACADEMIC_CALENDAR_ID, $this->getId());
         if (!isset($this->lastStudentJobHistoryCriteria) || !$this->lastStudentJobHistoryCriteria->equals($criteria)) {
             $this->collStudentJobHistorys = StudentJobHistoryPeer::doSelectJoinCitation($criteria, $con);
         }
     }
     $this->lastStudentJobHistoryCriteria = $criteria;
     return $this->collStudentJobHistorys;
 }
 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(StudentJobHistoryPeer::ID, $pks, Criteria::IN);
         $objs = StudentJobHistoryPeer::doSelect($criteria, $con);
     }
     return $objs;
 }