/** * Return the string representation for the birth country * * @return string */ public function getBirthCountryRepresentation() { $country = CountryPeer::retrieveByPK($this->getBirthCountry()); if ($country) { return $country->getName(); } }
public function getCountryname($cid) { if ($cid) { return CountryPeer::retrieveByPK($cid)->getName(); } else { return "NA"; } }
public function executeAdvancesearch() { $this->clearattrib(); $c = new Criteria(); $c->addAscendingOrderByColumn('name'); $branches = BranchPeer::doSelect($c); $options = array(); $options[] = 'Select'; foreach ($branches as $branch) { $options[$branch->getId()] = $branch->getName(); } $this->broptions = $options; //Year of graduation $options = array(); $options[] = 'Select'; for ($i = sfConfig::get('app_year_start'); $i <= sfConfig::get('app_year_end'); $i++) { $options[$i] = $i; } $this->yroptions = $options; //Chapter(s) affiliation $c = new Criteria(); $c->addAscendingOrderByColumn('name'); $chapters = ChapterPeer::doSelect($c); $options = array(); $options[] = 'Select'; foreach ($chapters as $chapter) { $options[$chapter->getId()] = $chapter->getName(); } $this->choptions = $options; //User type $options = array(); $options[0] = sfConfig::get('app_usertype_0'); $options[1] = sfConfig::get('app_usertype_1'); $options[2] = sfConfig::get('app_usertype_2'); $this->useroptions = $options; //Country $c = new Criteria(); $c->addAscendingOrderByColumn('name'); $countries = CountryPeer::doSelect($c); $options = array(); $options[] = 'Select'; foreach ($countries as $country) { $options[$country->getId()] = $country->getName(); //if($country->getName() === 'India'){ //$this->countryselected = $country->getId(); //} } $this->countryoptions = $options; $c = new Criteria(); $this->worktype = WorktypePeer::doSelect($c); }
public static function doSelectJoinAllExceptReligion(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } EmployeeParentsPeer::addSelectColumns($c); $startcol2 = EmployeeParentsPeer::NUM_COLUMNS - EmployeeParentsPeer::NUM_LAZY_LOAD_COLUMNS + 1; EmployeePeer::addSelectColumns($c); $startcol3 = $startcol2 + EmployeePeer::NUM_COLUMNS; CountryPeer::addSelectColumns($c); $startcol4 = $startcol3 + CountryPeer::NUM_COLUMNS; $c->addJoin(EmployeeParentsPeer::EMPLOYEE_ID, EmployeePeer::ID); $c->addJoin(EmployeeParentsPeer::COUNTRY_ID, CountryPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = EmployeeParentsPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = EmployeePeer::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->getEmployee(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addEmployeeParents($obj1); break; } } if ($newObject) { $obj2->initEmployeeParentss(); $obj2->addEmployeeParents($obj1); } $omClass = CountryPeer::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->getCountry(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addEmployeeParents($obj1); break; } } if ($newObject) { $obj3->initEmployeeParentss(); $obj3->addEmployeeParents($obj1); } $results[] = $obj1; } return $results; }
private function getNationalites() { /* Get Nationalities */ $nationalityCrit = new Criteria(); $nationalityCrit->addAscendingOrderByColumn(CountryPeer::PRINTABLE_NAME); $nationalities = CountryPeer::doSelect($nationalityCrit); return $nationalities; }
/** * Find object by primary key using raw SQL to go fast. * Bypass doSelect() and the object formatter by using generated code. * * @param mixed $key Primary key to use for the query * @param PropelPDO $con A connection object * * @return Country A model object, or null if the key is not found * @throws PropelException */ protected function findPkSimple($key, $con) { $sql = 'SELECT `ID`, `NAME`, `ISO_CODE`, `ISO_SHORT_CODE`, `DEMONYM`, `DEFAULT_CURRENCY_ID` FROM `country` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->execute(); } catch (Exception $e) { Propel::log($e->getMessage(), Propel::LOG_ERR); throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e); } $obj = null; if ($row = $stmt->fetch(PDO::FETCH_NUM)) { $obj = new Country(); $obj->hydrate($row); CountryPeer::addInstanceToPool($obj, (string) $key); } $stmt->closeCursor(); return $obj; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CountryPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setIso($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setName($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setPrintableName($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setIso3($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setNumcode($arr[$keys[5]]); } }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @return Country[] * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(CountryPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(CountryPeer::DATABASE_NAME); $criteria->add(CountryPeer::ID, $pks, Criteria::IN); $objs = CountryPeer::doSelect($criteria, $con); } return $objs; }
/** * This is a method for emulating ON DELETE CASCADE for DBs that don't support this * feature (like MySQL or SQLite). * * This method is not very speedy because it must perform a query first to get * the implicated records and then perform the deletes by calling those Peer classes. * * This method should be used within a transaction if possible. * * @param Criteria $criteria * @param PropelPDO $con * @return int The number of affected rows (if supported by underlying database driver). */ protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con) { // initialize var to track total num of affected rows $affectedRows = 0; // first find the objects that are implicated by the $criteria $objects = CurrencyPeer::doSelect($criteria, $con); foreach ($objects as $obj) { // delete related Country objects $criteria = new Criteria(CountryPeer::DATABASE_NAME); $criteria->add(CountryPeer::DEFAULT_CURRENCY_ID, $obj->getId()); $affectedRows += CountryPeer::doDelete($criteria, $con); } return $affectedRows; }
public static function doSelectJoinAllExceptClassGroup(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } StudentDetailPeer::addSelectColumns($c); $startcol2 = StudentDetailPeer::NUM_COLUMNS - StudentDetailPeer::NUM_LAZY_LOAD_COLUMNS + 1; RegionPeer::addSelectColumns($c); $startcol3 = $startcol2 + RegionPeer::NUM_COLUMNS; ReligionPeer::addSelectColumns($c); $startcol4 = $startcol3 + ReligionPeer::NUM_COLUMNS; CountryPeer::addSelectColumns($c); $startcol5 = $startcol4 + CountryPeer::NUM_COLUMNS; AcademicCalendarPeer::addSelectColumns($c); $startcol6 = $startcol5 + AcademicCalendarPeer::NUM_COLUMNS; CountryPeer::addSelectColumns($c); $startcol7 = $startcol6 + CountryPeer::NUM_COLUMNS; $c->addJoin(StudentDetailPeer::REGION_ID, RegionPeer::ID); $c->addJoin(StudentDetailPeer::RELIGION_ID, ReligionPeer::ID); $c->addJoin(StudentDetailPeer::NATIONALITY, CountryPeer::ID); $c->addJoin(StudentDetailPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $c->addJoin(StudentDetailPeer::COUNTRY_ID, CountryPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = StudentDetailPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = RegionPeer::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->getRegion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addStudentDetail($obj1); break; } } if ($newObject) { $obj2->initStudentDetails(); $obj2->addStudentDetail($obj1); } $omClass = ReligionPeer::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->getReligion(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addStudentDetail($obj1); break; } } if ($newObject) { $obj3->initStudentDetails(); $obj3->addStudentDetail($obj1); } $omClass = CountryPeer::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->getCountryRelatedByNationality(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addStudentDetailRelatedByNationality($obj1); break; } } if ($newObject) { $obj4->initStudentDetailsRelatedByNationality(); $obj4->addStudentDetailRelatedByNationality($obj1); } $omClass = AcademicCalendarPeer::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->getAcademicCalendar(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addStudentDetail($obj1); break; } } if ($newObject) { $obj5->initStudentDetails(); $obj5->addStudentDetail($obj1); } $omClass = CountryPeer::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->getCountryRelatedByCountryId(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addStudentDetailRelatedByCountryId($obj1); break; } } if ($newObject) { $obj6->initStudentDetailsRelatedByCountryId(); $obj6->addStudentDetailRelatedByCountryId($obj1); } $results[] = $obj1; } return $results; }
<td width="2%" style="text-align:center; vertical-align:middle;">:</td> <td style="vertical-align:middle;"> <p class="detail" style="font-weight: bold;"><?php echo $student_detail->getShortName() ? $student_detail->getShortName() : ''; ?> </p> </td> <td style="vertical-align:middle;"><label><?php echo __('Nationality'); ?> </label></td> <td width="2%" style="text-align:center; vertical-align:middle;">:</td> <td style="vertical-align:middle;"> <p class="detail" style="font-weight: bold;"> <?php $ctr = CountryPeer::retrieveByPk($student_detail->getNationality()); echo $student_detail->getNationality() ? $ctr->toString() : ''; ?> </p> </td> </tr> <tr> <td style="vertical-align:middle;"><label ><?php echo __('Sex'); ?> </label></td> <td width="2%" style="text-align:center; vertical-align:middle;">:</td> <td style="vertical-align:middle;"> <p class="detail"> <?php
public function executeDelete() { $country = CountryPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($country); $ref_error = 0; foreach ($country->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $country->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('country/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('country/delete', '_ERR_DELETE_ (' . $country->toString() . ' - id:' . $country->getId() . ')'); } else { $country->delete(); } return $this->forward('country', 'list'); }
if ($chap) { echo "<b>" . ChapterPeer::retrieveByPK($chap)->getname() . "</b>"; } else { echo '<i>any</i>'; } ?> <br>Location: <?php if ($loc) { echo "<b>" . $loc . "</b>"; } else { echo '<i>any</i>'; } ?> <br>Country: <?php if ($cn) { echo "<b>" . CountryPeer::retrieveByPK($cn)->getname() . "</b>"; } else { echo '<i>any</i>'; } ?> </center> </div> <?php } ?> <div class="vspacer20"> </div> <div class="centermsg">Note: Number of results may vary from actual statistics due to privacy settings.</div> <div class="vspacer10"> </div> </div>
public static function doSelectJoinAllExceptAcademicCalendar(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } TestApplicantDetailPeer::addSelectColumns($c); $startcol2 = TestApplicantDetailPeer::NUM_COLUMNS - TestApplicantDetailPeer::NUM_LAZY_LOAD_COLUMNS + 1; RegionPeer::addSelectColumns($c); $startcol3 = $startcol2 + RegionPeer::NUM_COLUMNS; ReligionPeer::addSelectColumns($c); $startcol4 = $startcol3 + ReligionPeer::NUM_COLUMNS; CountryPeer::addSelectColumns($c); $startcol5 = $startcol4 + CountryPeer::NUM_COLUMNS; $c->addJoin(TestApplicantDetailPeer::REGION_ID, RegionPeer::ID); $c->addJoin(TestApplicantDetailPeer::RELIGION_ID, ReligionPeer::ID); $c->addJoin(TestApplicantDetailPeer::COUNTRY_ID, CountryPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = TestApplicantDetailPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = RegionPeer::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->getRegion(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addTestApplicantDetail($obj1); break; } } if ($newObject) { $obj2->initTestApplicantDetails(); $obj2->addTestApplicantDetail($obj1); } $omClass = ReligionPeer::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->getReligion(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addTestApplicantDetail($obj1); break; } } if ($newObject) { $obj3->initTestApplicantDetails(); $obj3->addTestApplicantDetail($obj1); } $omClass = CountryPeer::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->getCountry(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addTestApplicantDetail($obj1); break; } } if ($newObject) { $obj4->initTestApplicantDetails(); $obj4->addTestApplicantDetail($obj1); } $results[] = $obj1; } return $results; }
/** * Selects a collection of State objects pre-filled with all related objects. * * @param Criteria $criteria * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of State objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(self::DATABASE_NAME); } StatePeer::addSelectColumns($criteria); $startcol2 = StatePeer::NUM_HYDRATE_COLUMNS; CountryPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + CountryPeer::NUM_HYDRATE_COLUMNS; $criteria->addJoin(StatePeer::COUNTRY_ID, CountryPeer::ID, $join_behavior); // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BaseStatePeer', $criteria, $con); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = StatePeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = StatePeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $cls = StatePeer::getOMClass(); $obj1 = new $cls(); $obj1->hydrate($row); StatePeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Country rows $key2 = CountryPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = CountryPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = CountryPeer::getOMClass(); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); CountryPeer::addInstanceToPool($obj2, $key2); } // if obj2 loaded // Add the $obj1 (State) to the collection in $obj2 (Country) $obj2->addState($obj1); } // if joined row not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
public function executeEdit() { //$userid = $this->getRequestParameter('id'); $username = $this->getUser()->getAttribute('username'); $c = new Criteria(); $c->add(UserPeer::USERNAME, $username); $user = UserPeer::doSelectOne($c); $userid = $user->getId(); $c = new Criteria(); $c->add(AddressPeer::USER_ID, $userid); $c->add(AddressPeer::TYPE, '0'); $this->address1 = AddressPeer::doSelectOne($c); if (!$this->address1) { $this->address1 = new Address(); } $c = new Criteria(); $c->add(AddressPeer::USER_ID, $userid); $c->add(AddressPeer::TYPE, '1'); $this->address2 = AddressPeer::doSelectOne($c); if (!$this->address2) { $this->address2 = new Address(); } $c = new Criteria(); $c->add(AddressPeer::USER_ID, $userid); $c->add(AddressPeer::TYPE, '2'); $this->address3 = AddressPeer::doSelectOne($c); if (!$this->address3) { $this->address3 = new Address(); } $this->userid = $userid; $this->privacyoptions = array('1' => 'Myself', '2' => 'Friends', '3' => 'IT BHU', '4' => 'Everyone'); //Country $c = new Criteria(); $c->addAscendingOrderByColumn('name'); $countries = CountryPeer::doSelect($c); $options = array(); $options[] = 'Select'; foreach ($countries as $country) { $options[$country->getId()] = $country->getName(); } $this->countryoptions = $options; }
<tr> <td style="vertical-align:middle;"><label ><?php echo __('Short name'); ?> </label><br /> <p class="detail"><?php echo $test_applicant_detail->getShortName() ? $test_applicant_detail->getShortName() : '-'; ?> </p> </td> <td style="vertical-align:middle;"><label ><?php echo __('Nationality'); ?> </label><br /> <p class="detail"><b><?php $ctr = CountryPeer::retrieveByPk($test_applicant_detail->getNationality()); echo $test_applicant_detail->getNationality() ? $ctr->toString() : '-'; ?> </b></p> </td> <td style="vertical-align:middle;"><label ><?php echo __('Religion'); ?> </label><br /> <p class="detail"><b><?php echo $test_applicant_detail->getReligion() ? $test_applicant_detail->getReligion()->toString() : '-'; ?> </b></p> </td> </tr>
public static function doSelectJoinAllExceptSubdistrict(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } NgTestApplicantParentsPeer::addSelectColumns($c); $startcol2 = NgTestApplicantParentsPeer::NUM_COLUMNS - NgTestApplicantParentsPeer::NUM_LAZY_LOAD_COLUMNS + 1; NgTestApplicantPeer::addSelectColumns($c); $startcol3 = $startcol2 + NgTestApplicantPeer::NUM_COLUMNS; ReligionPeer::addSelectColumns($c); $startcol4 = $startcol3 + ReligionPeer::NUM_COLUMNS; DegreePeer::addSelectColumns($c); $startcol5 = $startcol4 + DegreePeer::NUM_COLUMNS; SalaryPeer::addSelectColumns($c); $startcol6 = $startcol5 + SalaryPeer::NUM_COLUMNS; JobTypePeer::addSelectColumns($c); $startcol7 = $startcol6 + JobTypePeer::NUM_COLUMNS; CountryPeer::addSelectColumns($c); $startcol8 = $startcol7 + CountryPeer::NUM_COLUMNS; RegionPeer::addSelectColumns($c); $startcol9 = $startcol8 + RegionPeer::NUM_COLUMNS; CityPeer::addSelectColumns($c); $startcol10 = $startcol9 + CityPeer::NUM_COLUMNS; DistrictPeer::addSelectColumns($c); $startcol11 = $startcol10 + DistrictPeer::NUM_COLUMNS; $c->addJoin(NgTestApplicantParentsPeer::NG_TEST_APPLICANT_ID, NgTestApplicantPeer::ID); $c->addJoin(NgTestApplicantParentsPeer::RELIGION_ID, ReligionPeer::ID); $c->addJoin(NgTestApplicantParentsPeer::DEGREE_ID, DegreePeer::ID); $c->addJoin(NgTestApplicantParentsPeer::SALARY_ID, SalaryPeer::ID); $c->addJoin(NgTestApplicantParentsPeer::JOB_TYPE_ID, JobTypePeer::ID); $c->addJoin(NgTestApplicantParentsPeer::COUNTRY_ID, CountryPeer::ID); $c->addJoin(NgTestApplicantParentsPeer::REGION_ID, RegionPeer::ID); $c->addJoin(NgTestApplicantParentsPeer::CITY_ID, CityPeer::ID); $c->addJoin(NgTestApplicantParentsPeer::DISTRICT_ID, DistrictPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = NgTestApplicantParentsPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = NgTestApplicantPeer::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->getNgTestApplicant(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addNgTestApplicantParents($obj1); break; } } if ($newObject) { $obj2->initNgTestApplicantParentss(); $obj2->addNgTestApplicantParents($obj1); } $omClass = ReligionPeer::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->getReligion(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addNgTestApplicantParents($obj1); break; } } if ($newObject) { $obj3->initNgTestApplicantParentss(); $obj3->addNgTestApplicantParents($obj1); } $omClass = DegreePeer::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->getDegree(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addNgTestApplicantParents($obj1); break; } } if ($newObject) { $obj4->initNgTestApplicantParentss(); $obj4->addNgTestApplicantParents($obj1); } $omClass = SalaryPeer::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->getSalary(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addNgTestApplicantParents($obj1); break; } } if ($newObject) { $obj5->initNgTestApplicantParentss(); $obj5->addNgTestApplicantParents($obj1); } $omClass = JobTypePeer::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->getJobType(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addNgTestApplicantParents($obj1); break; } } if ($newObject) { $obj6->initNgTestApplicantParentss(); $obj6->addNgTestApplicantParents($obj1); } $omClass = CountryPeer::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->getCountry(); if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) { $newObject = false; $temp_obj7->addNgTestApplicantParents($obj1); break; } } if ($newObject) { $obj7->initNgTestApplicantParentss(); $obj7->addNgTestApplicantParents($obj1); } $omClass = RegionPeer::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->getRegion(); if ($temp_obj8->getPrimaryKey() === $obj8->getPrimaryKey()) { $newObject = false; $temp_obj8->addNgTestApplicantParents($obj1); break; } } if ($newObject) { $obj8->initNgTestApplicantParentss(); $obj8->addNgTestApplicantParents($obj1); } $omClass = CityPeer::getOMClass(); $cls = Propel::import($omClass); $obj9 = new $cls(); $obj9->hydrate($rs, $startcol9); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj9 = $temp_obj1->getCity(); if ($temp_obj9->getPrimaryKey() === $obj9->getPrimaryKey()) { $newObject = false; $temp_obj9->addNgTestApplicantParents($obj1); break; } } if ($newObject) { $obj9->initNgTestApplicantParentss(); $obj9->addNgTestApplicantParents($obj1); } $omClass = DistrictPeer::getOMClass(); $cls = Propel::import($omClass); $obj10 = new $cls(); $obj10->hydrate($rs, $startcol10); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj10 = $temp_obj1->getDistrict(); if ($temp_obj10->getPrimaryKey() === $obj10->getPrimaryKey()) { $newObject = false; $temp_obj10->addNgTestApplicantParents($obj1); break; } } if ($newObject) { $obj10->initNgTestApplicantParentss(); $obj10->addNgTestApplicantParents($obj1); } $results[] = $obj1; } return $results; }
public function getCountryRelatedByNationality($con = null) { include_once 'lib/model/om/BaseCountryPeer.php'; if ($this->aCountryRelatedByNationality === null && $this->nationality !== null) { $this->aCountryRelatedByNationality = CountryPeer::retrieveByPK($this->nationality, $con); } return $this->aCountryRelatedByNationality; }
public function getCountry($con = null) { include_once 'lib/model/om/BaseCountryPeer.php'; if ($this->aCountry === null && $this->country_id !== null) { $this->aCountry = CountryPeer::retrieveByPK($this->country_id, $con); } return $this->aCountry; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CountryPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setName($arr[$keys[1]]); } }
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's BasePeer::TYPE_PHPNAME * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CountryPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setName($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setIsoCode($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setIsoShortCode($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setDemonym($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setDefaultCurrencyId($arr[$keys[5]]); } }
public static function doSelectJoinAllExceptClassLevelRelatedByLastClass(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } NgTestApplicantPeer::addSelectColumns($c); $startcol2 = NgTestApplicantPeer::NUM_COLUMNS - NgTestApplicantPeer::NUM_LAZY_LOAD_COLUMNS + 1; NgRegInfoPeer::addSelectColumns($c); $startcol3 = $startcol2 + NgRegInfoPeer::NUM_COLUMNS; DepartmentPeer::addSelectColumns($c); $startcol4 = $startcol3 + DepartmentPeer::NUM_COLUMNS; NgRegTestPeriodPeer::addSelectColumns($c); $startcol5 = $startcol4 + NgRegTestPeriodPeer::NUM_COLUMNS; NgStatusApplicantPeer::addSelectColumns($c); $startcol6 = $startcol5 + NgStatusApplicantPeer::NUM_COLUMNS; NgApplicantCategoryPeer::addSelectColumns($c); $startcol7 = $startcol6 + NgApplicantCategoryPeer::NUM_COLUMNS; CountryPeer::addSelectColumns($c); $startcol8 = $startcol7 + CountryPeer::NUM_COLUMNS; ReligionPeer::addSelectColumns($c); $startcol9 = $startcol8 + ReligionPeer::NUM_COLUMNS; RegionPeer::addSelectColumns($c); $startcol10 = $startcol9 + RegionPeer::NUM_COLUMNS; CityPeer::addSelectColumns($c); $startcol11 = $startcol10 + CityPeer::NUM_COLUMNS; DistrictPeer::addSelectColumns($c); $startcol12 = $startcol11 + DistrictPeer::NUM_COLUMNS; SubdistrictPeer::addSelectColumns($c); $startcol13 = $startcol12 + SubdistrictPeer::NUM_COLUMNS; $c->addJoin(NgTestApplicantPeer::NG_REG_INFO_ID, NgRegInfoPeer::ID); $c->addJoin(NgTestApplicantPeer::DEPARTMENT_ID, DepartmentPeer::ID); $c->addJoin(NgTestApplicantPeer::NG_REG_TEST_PERIOD_ID, NgRegTestPeriodPeer::ID); $c->addJoin(NgTestApplicantPeer::NG_STATUS_APPLICANT_ID, NgStatusApplicantPeer::ID); $c->addJoin(NgTestApplicantPeer::NG_APPLICANT_CATEGORY_ID, NgApplicantCategoryPeer::ID); $c->addJoin(NgTestApplicantPeer::COUNTRY_ID, CountryPeer::ID); $c->addJoin(NgTestApplicantPeer::RELIGION_ID, ReligionPeer::ID); $c->addJoin(NgTestApplicantPeer::REGION_ID, RegionPeer::ID); $c->addJoin(NgTestApplicantPeer::CITY_ID, CityPeer::ID); $c->addJoin(NgTestApplicantPeer::DISTRICT_ID, DistrictPeer::ID); $c->addJoin(NgTestApplicantPeer::SUBDISTRICT_ID, SubdistrictPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = NgTestApplicantPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = NgRegInfoPeer::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->getNgRegInfo(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addNgTestApplicant($obj1); break; } } if ($newObject) { $obj2->initNgTestApplicants(); $obj2->addNgTestApplicant($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->addNgTestApplicant($obj1); break; } } if ($newObject) { $obj3->initNgTestApplicants(); $obj3->addNgTestApplicant($obj1); } $omClass = NgRegTestPeriodPeer::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->getNgRegTestPeriod(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addNgTestApplicant($obj1); break; } } if ($newObject) { $obj4->initNgTestApplicants(); $obj4->addNgTestApplicant($obj1); } $omClass = NgStatusApplicantPeer::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->getNgStatusApplicant(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addNgTestApplicant($obj1); break; } } if ($newObject) { $obj5->initNgTestApplicants(); $obj5->addNgTestApplicant($obj1); } $omClass = NgApplicantCategoryPeer::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->getNgApplicantCategory(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addNgTestApplicant($obj1); break; } } if ($newObject) { $obj6->initNgTestApplicants(); $obj6->addNgTestApplicant($obj1); } $omClass = CountryPeer::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->getCountry(); if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) { $newObject = false; $temp_obj7->addNgTestApplicant($obj1); break; } } if ($newObject) { $obj7->initNgTestApplicants(); $obj7->addNgTestApplicant($obj1); } $omClass = ReligionPeer::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->getReligion(); if ($temp_obj8->getPrimaryKey() === $obj8->getPrimaryKey()) { $newObject = false; $temp_obj8->addNgTestApplicant($obj1); break; } } if ($newObject) { $obj8->initNgTestApplicants(); $obj8->addNgTestApplicant($obj1); } $omClass = RegionPeer::getOMClass(); $cls = Propel::import($omClass); $obj9 = new $cls(); $obj9->hydrate($rs, $startcol9); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj9 = $temp_obj1->getRegion(); if ($temp_obj9->getPrimaryKey() === $obj9->getPrimaryKey()) { $newObject = false; $temp_obj9->addNgTestApplicant($obj1); break; } } if ($newObject) { $obj9->initNgTestApplicants(); $obj9->addNgTestApplicant($obj1); } $omClass = CityPeer::getOMClass(); $cls = Propel::import($omClass); $obj10 = new $cls(); $obj10->hydrate($rs, $startcol10); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj10 = $temp_obj1->getCity(); if ($temp_obj10->getPrimaryKey() === $obj10->getPrimaryKey()) { $newObject = false; $temp_obj10->addNgTestApplicant($obj1); break; } } if ($newObject) { $obj10->initNgTestApplicants(); $obj10->addNgTestApplicant($obj1); } $omClass = DistrictPeer::getOMClass(); $cls = Propel::import($omClass); $obj11 = new $cls(); $obj11->hydrate($rs, $startcol11); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj11 = $temp_obj1->getDistrict(); if ($temp_obj11->getPrimaryKey() === $obj11->getPrimaryKey()) { $newObject = false; $temp_obj11->addNgTestApplicant($obj1); break; } } if ($newObject) { $obj11->initNgTestApplicants(); $obj11->addNgTestApplicant($obj1); } $omClass = SubdistrictPeer::getOMClass(); $cls = Propel::import($omClass); $obj12 = new $cls(); $obj12->hydrate($rs, $startcol12); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj12 = $temp_obj1->getSubdistrict(); if ($temp_obj12->getPrimaryKey() === $obj12->getPrimaryKey()) { $newObject = false; $temp_obj12->addNgTestApplicant($obj1); break; } } if ($newObject) { $obj12->initNgTestApplicants(); $obj12->addNgTestApplicant($obj1); } $results[] = $obj1; } return $results; }