Beispiel #1
0
 public function getStudentThesis($con = null)
 {
     include_once 'lib/model/om/BaseStudentThesisPeer.php';
     if ($this->aStudentThesis === null && $this->student_thesis_id !== null) {
         $this->aStudentThesis = StudentThesisPeer::retrieveByPK($this->student_thesis_id, $con);
     }
     return $this->aStudentThesis;
 }
 public function getStudentThesissJoinStudent($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseStudentThesisPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collStudentThesiss === null) {
         if ($this->isNew()) {
             $this->collStudentThesiss = array();
         } else {
             $criteria->add(StudentThesisPeer::ACADEMIC_CALENDAR_ID, $this->getId());
             $this->collStudentThesiss = StudentThesisPeer::doSelectJoinStudent($criteria, $con);
         }
     } else {
         $criteria->add(StudentThesisPeer::ACADEMIC_CALENDAR_ID, $this->getId());
         if (!isset($this->lastStudentThesisCriteria) || !$this->lastStudentThesisCriteria->equals($criteria)) {
             $this->collStudentThesiss = StudentThesisPeer::doSelectJoinStudent($criteria, $con);
         }
     }
     $this->lastStudentThesisCriteria = $criteria;
     return $this->collStudentThesiss;
 }
 public static function doSelectJoinAllExceptEmployee(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     ThesisAdvisorPeer::addSelectColumns($c);
     $startcol2 = ThesisAdvisorPeer::NUM_COLUMNS - ThesisAdvisorPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     StudentThesisPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + StudentThesisPeer::NUM_COLUMNS;
     $c->addJoin(ThesisAdvisorPeer::STUDENT_THESIS_ID, StudentThesisPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = ThesisAdvisorPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = StudentThesisPeer::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->getStudentThesis();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addThesisAdvisor($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initThesisAdvisors();
             $obj2->addThesisAdvisor($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Beispiel #4
0
 public function executeDelete()
 {
     $student_thesis = StudentThesisPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($student_thesis);
     $ref_error = 0;
     foreach ($student_thesis->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $student_thesis->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('student_thesis/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('student_thesis/delete', '_ERR_DELETE_ (' . $student_thesis->toString() . ' - id:' . $student_thesis->getId() . ')');
     } else {
         $student_thesis->delete();
     }
     return $this->forward('student_thesis', 'list');
 }
Beispiel #5
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = StudentThesisPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setThesisTitle($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setStudentId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setStatus($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setAcademicCalendarId($arr[$keys[4]]);
     }
 }
 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(StudentThesisPeer::ID, $pks, Criteria::IN);
         $objs = StudentThesisPeer::doSelect($criteria, $con);
     }
     return $objs;
 }