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(TestApplicantDetailPeer::ID, $pks, Criteria::IN); $objs = TestApplicantDetailPeer::doSelect($criteria, $con); } return $objs; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = TestApplicantDetailPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setShortName($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setPob($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setDob($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setSex($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setAddress($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setRegionId($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setPostCode($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setPhone($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setCellphone($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setReligionId($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setSchoolOfOrigin($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setGraduationYear($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setGraduationGrade($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { $this->setCompany($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { $this->setJobTitle($arr[$keys[15]]); } if (array_key_exists($keys[16], $arr)) { $this->setCollegeOfOrigin($arr[$keys[16]]); } if (array_key_exists($keys[17], $arr)) { $this->setDepartmentOfOrigin($arr[$keys[17]]); } if (array_key_exists($keys[18], $arr)) { $this->setRegYear($arr[$keys[18]]); } if (array_key_exists($keys[19], $arr)) { $this->setParentName($arr[$keys[19]]); } if (array_key_exists($keys[20], $arr)) { $this->setNationality($arr[$keys[20]]); } if (array_key_exists($keys[21], $arr)) { $this->setChildNumber($arr[$keys[21]]); } if (array_key_exists($keys[22], $arr)) { $this->setSiblings($arr[$keys[22]]); } if (array_key_exists($keys[23], $arr)) { $this->setBloodSiblings($arr[$keys[23]]); } if (array_key_exists($keys[24], $arr)) { $this->setStepSiblings($arr[$keys[24]]); } if (array_key_exists($keys[25], $arr)) { $this->setAdoptSiblings($arr[$keys[25]]); } if (array_key_exists($keys[26], $arr)) { $this->setNativeLanguage($arr[$keys[26]]); } if (array_key_exists($keys[27], $arr)) { $this->setResidenceStatus($arr[$keys[27]]); } if (array_key_exists($keys[28], $arr)) { $this->setHomeDistance($arr[$keys[28]]); } if (array_key_exists($keys[29], $arr)) { $this->setOrphanageStatus($arr[$keys[29]]); } if (array_key_exists($keys[30], $arr)) { $this->setTransport($arr[$keys[30]]); } if (array_key_exists($keys[31], $arr)) { $this->setFather($arr[$keys[31]]); } if (array_key_exists($keys[32], $arr)) { $this->setMother($arr[$keys[32]]); } if (array_key_exists($keys[33], $arr)) { $this->setFatherJob($arr[$keys[33]]); } if (array_key_exists($keys[34], $arr)) { $this->setMotherJob($arr[$keys[34]]); } if (array_key_exists($keys[35], $arr)) { $this->setDetailFatherJob($arr[$keys[35]]); } if (array_key_exists($keys[36], $arr)) { $this->setDetailMotherJob($arr[$keys[36]]); } if (array_key_exists($keys[37], $arr)) { $this->setRegNote($arr[$keys[37]]); } if (array_key_exists($keys[38], $arr)) { $this->setAcademicCalendarId($arr[$keys[38]]); } if (array_key_exists($keys[39], $arr)) { $this->setAgeYear($arr[$keys[39]]); } if (array_key_exists($keys[40], $arr)) { $this->setAgeMonth($arr[$keys[40]]); } if (array_key_exists($keys[41], $arr)) { $this->setResidenceDetail($arr[$keys[41]]); } if (array_key_exists($keys[42], $arr)) { $this->setResidenceElse($arr[$keys[42]]); } if (array_key_exists($keys[43], $arr)) { $this->setIllness($arr[$keys[43]]); } if (array_key_exists($keys[44], $arr)) { $this->setIllnessNote($arr[$keys[44]]); } if (array_key_exists($keys[45], $arr)) { $this->setNeed($arr[$keys[45]]); } if (array_key_exists($keys[46], $arr)) { $this->setNeedNote($arr[$keys[46]]); } if (array_key_exists($keys[47], $arr)) { $this->setBloodType($arr[$keys[47]]); } if (array_key_exists($keys[48], $arr)) { $this->setTall($arr[$keys[48]]); } if (array_key_exists($keys[49], $arr)) { $this->setWeight($arr[$keys[49]]); } if (array_key_exists($keys[50], $arr)) { $this->setSchoolOfOriginAddress($arr[$keys[50]]); } if (array_key_exists($keys[51], $arr)) { $this->setCountryId($arr[$keys[51]]); } }
public static function doSelectJoinAllExceptLocationRelatedByLocation2(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } TestApplicantPeer::addSelectColumns($c); $startcol2 = TestApplicantPeer::NUM_COLUMNS - TestApplicantPeer::NUM_LAZY_LOAD_COLUMNS + 1; TestApplicantDetailPeer::addSelectColumns($c); $startcol3 = $startcol2 + TestApplicantDetailPeer::NUM_COLUMNS; DepartmentPeer::addSelectColumns($c); $startcol4 = $startcol3 + DepartmentPeer::NUM_COLUMNS; ClassGroupPeer::addSelectColumns($c); $startcol5 = $startcol4 + ClassGroupPeer::NUM_COLUMNS; RegTestPeriodPeer::addSelectColumns($c); $startcol6 = $startcol5 + RegTestPeriodPeer::NUM_COLUMNS; DepartmentPeer::addSelectColumns($c); $startcol7 = $startcol6 + DepartmentPeer::NUM_COLUMNS; ClassGroupPeer::addSelectColumns($c); $startcol8 = $startcol7 + ClassGroupPeer::NUM_COLUMNS; RegTestPeriodPeer::addSelectColumns($c); $startcol9 = $startcol8 + RegTestPeriodPeer::NUM_COLUMNS; $c->addJoin(TestApplicantPeer::TEST_APPLICANT_DETAIL_ID, TestApplicantDetailPeer::ID); $c->addJoin(TestApplicantPeer::DEPARTMENT_1, DepartmentPeer::ID); $c->addJoin(TestApplicantPeer::CLASS_GROUP1, ClassGroupPeer::ID); $c->addJoin(TestApplicantPeer::REG_TEST_PERIOD1, RegTestPeriodPeer::ID); $c->addJoin(TestApplicantPeer::DEPARTMENT_2, DepartmentPeer::ID); $c->addJoin(TestApplicantPeer::CLASS_GROUP2, ClassGroupPeer::ID); $c->addJoin(TestApplicantPeer::REG_TEST_PERIOD2, RegTestPeriodPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = TestApplicantPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = TestApplicantDetailPeer::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->getTestApplicantDetail(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addTestApplicant($obj1); break; } } if ($newObject) { $obj2->initTestApplicants(); $obj2->addTestApplicant($obj1); } $omClass = DepartmentPeer::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->getDepartmentRelatedByDepartment1(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addTestApplicantRelatedByDepartment1($obj1); break; } } if ($newObject) { $obj3->initTestApplicantsRelatedByDepartment1(); $obj3->addTestApplicantRelatedByDepartment1($obj1); } $omClass = ClassGroupPeer::getOMClass(); $cls = Propel::import($omClass); $obj4 = new $cls(); $obj4->hydrate($rs, $startcol4); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj4 = $temp_obj1->getClassGroupRelatedByClassGroup1(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addTestApplicantRelatedByClassGroup1($obj1); break; } } if ($newObject) { $obj4->initTestApplicantsRelatedByClassGroup1(); $obj4->addTestApplicantRelatedByClassGroup1($obj1); } $omClass = RegTestPeriodPeer::getOMClass(); $cls = Propel::import($omClass); $obj5 = new $cls(); $obj5->hydrate($rs, $startcol5); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj5 = $temp_obj1->getRegTestPeriodRelatedByRegTestPeriod1(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addTestApplicantRelatedByRegTestPeriod1($obj1); break; } } if ($newObject) { $obj5->initTestApplicantsRelatedByRegTestPeriod1(); $obj5->addTestApplicantRelatedByRegTestPeriod1($obj1); } $omClass = DepartmentPeer::getOMClass(); $cls = Propel::import($omClass); $obj6 = new $cls(); $obj6->hydrate($rs, $startcol6); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj6 = $temp_obj1->getDepartmentRelatedByDepartment2(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addTestApplicantRelatedByDepartment2($obj1); break; } } if ($newObject) { $obj6->initTestApplicantsRelatedByDepartment2(); $obj6->addTestApplicantRelatedByDepartment2($obj1); } $omClass = ClassGroupPeer::getOMClass(); $cls = Propel::import($omClass); $obj7 = new $cls(); $obj7->hydrate($rs, $startcol7); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj7 = $temp_obj1->getClassGroupRelatedByClassGroup2(); if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) { $newObject = false; $temp_obj7->addTestApplicantRelatedByClassGroup2($obj1); break; } } if ($newObject) { $obj7->initTestApplicantsRelatedByClassGroup2(); $obj7->addTestApplicantRelatedByClassGroup2($obj1); } $omClass = RegTestPeriodPeer::getOMClass(); $cls = Propel::import($omClass); $obj8 = new $cls(); $obj8->hydrate($rs, $startcol8); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj8 = $temp_obj1->getRegTestPeriodRelatedByRegTestPeriod2(); if ($temp_obj8->getPrimaryKey() === $obj8->getPrimaryKey()) { $newObject = false; $temp_obj8->addTestApplicantRelatedByRegTestPeriod2($obj1); break; } } if ($newObject) { $obj8->initTestApplicantsRelatedByRegTestPeriod2(); $obj8->addTestApplicantRelatedByRegTestPeriod2($obj1); } $results[] = $obj1; } return $results; }
public function getTestApplicantDetailsJoinCountry($criteria = null, $con = null) { include_once 'lib/model/om/BaseTestApplicantDetailPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collTestApplicantDetails === null) { if ($this->isNew()) { $this->collTestApplicantDetails = array(); } else { $criteria->add(TestApplicantDetailPeer::REGION_ID, $this->getId()); $this->collTestApplicantDetails = TestApplicantDetailPeer::doSelectJoinCountry($criteria, $con); } } else { $criteria->add(TestApplicantDetailPeer::REGION_ID, $this->getId()); if (!isset($this->lastTestApplicantDetailCriteria) || !$this->lastTestApplicantDetailCriteria->equals($criteria)) { $this->collTestApplicantDetails = TestApplicantDetailPeer::doSelectJoinCountry($criteria, $con); } } $this->lastTestApplicantDetailCriteria = $criteria; return $this->collTestApplicantDetails; }
public function filterApplicant($c, $filters) { $filters_key = array_keys($filters); foreach ($filters_key as $key) { $value = $filters[$key]; if ($value == '' || $value == null) { continue; } if ($key == 'TEST_APPLICANT_DETAIL_ID') { $c->addJoin(TestApplicantDetailPeer::ID, TestApplicantPeer::TEST_APPLICANT_DETAIL_ID); $column = TestApplicantDetailPeer::getTableMap()->getColumn('ID'); } else { $column = TestApplicantPeer::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); } } 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 function getTestApplicantDetail($con = null) { include_once 'lib/model/om/BaseTestApplicantDetailPeer.php'; if ($this->aTestApplicantDetail === null && $this->test_applicant_detail_id !== null) { $this->aTestApplicantDetail = TestApplicantDetailPeer::retrieveByPK($this->test_applicant_detail_id, $con); } return $this->aTestApplicantDetail; }
public function executeUpdateForget() { $code = $this->getRequestParameter('code'); $c = new Criteria(); $c->add(TestApplicantPeer::CODE, $code); $test_applicant = TestApplicantPeer::doSelectOne($c); if ($test_applicant != null) { $test_applicant_detail = TestApplicantDetailPeer::retrieveByPk($test_applicant->getTestApplicantDetailId()); $crypted = sha1(sfConfig::get('app_salt') . $test_applicant_detail->getDob('dmY')); $test_applicant->setPassword($crypted); $test_applicant->save(); return $this->redirect('applicant/access?code=' . $test_applicant->getCode() . '&dob=' . $test_applicant_detail->getDob('dmY')); } else { return $this->redirect('applicant/noaccess'); } }
public static function doSelectJoinAllExceptClassGroupRelatedByClassId(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } VApplicantTestPeer::addSelectColumns($c); $startcol2 = VApplicantTestPeer::NUM_COLUMNS - VApplicantTestPeer::NUM_LAZY_LOAD_COLUMNS + 1; TestApplicantDetailPeer::addSelectColumns($c); $startcol3 = $startcol2 + TestApplicantDetailPeer::NUM_COLUMNS; DepartmentPeer::addSelectColumns($c); $startcol4 = $startcol3 + DepartmentPeer::NUM_COLUMNS; RegTestPeriodPeer::addSelectColumns($c); $startcol5 = $startcol4 + RegTestPeriodPeer::NUM_COLUMNS; LocationPeer::addSelectColumns($c); $startcol6 = $startcol5 + LocationPeer::NUM_COLUMNS; $c->addJoin(VApplicantTestPeer::TEST_APPLICANT_DETAIL_ID, TestApplicantDetailPeer::ID); $c->addJoin(VApplicantTestPeer::DEPARTMENT_ID, DepartmentPeer::ID); $c->addJoin(VApplicantTestPeer::REG_TEST_PERIOD_ID, RegTestPeriodPeer::ID); $c->addJoin(VApplicantTestPeer::LOCATION_ID, LocationPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = VApplicantTestPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = TestApplicantDetailPeer::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->getTestApplicantDetail(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addVApplicantTest($obj1); break; } } if ($newObject) { $obj2->initVApplicantTests(); $obj2->addVApplicantTest($obj1); } $omClass = DepartmentPeer::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->getDepartment(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addVApplicantTest($obj1); break; } } if ($newObject) { $obj3->initVApplicantTests(); $obj3->addVApplicantTest($obj1); } $omClass = RegTestPeriodPeer::getOMClass(); $cls = Propel::import($omClass); $obj4 = new $cls(); $obj4->hydrate($rs, $startcol4); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj4 = $temp_obj1->getRegTestPeriod(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addVApplicantTest($obj1); break; } } if ($newObject) { $obj4->initVApplicantTests(); $obj4->addVApplicantTest($obj1); } $omClass = LocationPeer::getOMClass(); $cls = Propel::import($omClass); $obj5 = new $cls(); $obj5->hydrate($rs, $startcol5); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj5 = $temp_obj1->getLocation(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addVApplicantTest($obj1); break; } } if ($newObject) { $obj5->initVApplicantTests(); $obj5->addVApplicantTest($obj1); } $results[] = $obj1; } return $results; }
protected static function doOnDeleteCascade(Criteria $criteria, Connection $con) { $affectedRows = 0; $objects = SchoolPeer::doSelect($criteria, $con); foreach ($objects as $obj) { include_once 'lib/model/StudentDetail.php'; $c = new Criteria(); $c->add(StudentDetailPeer::SCHOOL_OF_ORIGIN, $obj->getId()); $affectedRows += StudentDetailPeer::doDelete($c, $con); include_once 'lib/model/TestApplicantDetail.php'; $c = new Criteria(); $c->add(TestApplicantDetailPeer::SCHOOL_OF_ORIGIN, $obj->getId()); $affectedRows += TestApplicantDetailPeer::doDelete($c, $con); } return $affectedRows; }