public static function getOptionsForSelect($c = null) { if (is_null($c)) { $c = new Criteria(); } $cities = array(); $cities_temp = CityPeer::doSelect($c); foreach ($cities_temp as $city) { $cities[$city->getId()] = $city->__toString(); } return $cities; }
/** * Get the associated City object * * @param PropelPDO Optional Connection object. * @return City The associated City object. * @throws PropelException */ public function getCity(PropelPDO $con = null) { if ($this->aCity === null && $this->city_id !== null) { $this->aCity = CityPeer::retrieveByPk($this->city_id); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aCity->addCityInfos($this); */ } return $this->aCity; }
/** * Selects a collection of CityInfo 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 CityInfo 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); } CityInfoPeer::addSelectColumns($criteria); $startcol2 = CityInfoPeer::NUM_COLUMNS - CityInfoPeer::NUM_LAZY_LOAD_COLUMNS; CityPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + (CityPeer::NUM_COLUMNS - CityPeer::NUM_LAZY_LOAD_COLUMNS); $criteria->addJoin(CityInfoPeer::CITY_ID, CityPeer::ID, $join_behavior); // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BaseCityInfoPeer', $criteria, $con); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = CityInfoPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = CityInfoPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://propel.phpdb.org/trac/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $cls = CityInfoPeer::getOMClass(false); $obj1 = new $cls(); $obj1->hydrate($row); CityInfoPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined City rows $key2 = CityPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = CityPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = CityPeer::getOMClass(false); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); CityPeer::addInstanceToPool($obj2, $key2); } // if obj2 loaded // Add the $obj1 (CityInfo) to the collection in $obj2 (City) $obj2->addCityInfo($obj1); } // if joined row not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
public function getCity($con = null) { include_once 'lib/model/om/BaseCityPeer.php'; if ($this->aCity === null && $this->city_id !== null) { $this->aCity = CityPeer::retrieveByPK($this->city_id, $con); } return $this->aCity; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CityPeer::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->setRegionId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setCreated($arr[$keys[3]]); } }
public function executeConfirmStudent(sfWebRequest $request) { sfContext::getInstance()->set("user", new FakeUser()); //tomo las intancias de las librerias. $i_identification_type = BaseCustomOptionsHolder::getInstance('IdentificationType'); $i_sex_type = BaseCustomOptionsHolder::getInstance('SexType'); $i_nationality = BaseCustomOptionsHolder::getInstance('Nationality'); $s_lastname = $this->getRequestParameter('apellido'); // Es obligatorio $s_firstname = $this->getRequestParameter('nombres'); // Es obligatorio $s_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('tipo_documento_id')); $s_identification_number = $this->getRequestParameter('nro_documento'); $s_sex = $i_sex_type->getSexType($this->getRequestParameter('sexo')); //Es obligatorio $s_phone = $this->getRequestParameter('telefono_fijo'); $s_birthdate = $this->getRequestParameter('fecha_nacimiento'); $s_birth_city = $this->getRequestParameter('ciudad_nacimiento_id'); $s_health_coverage_id = $this->getRequestParameter('obra_social_id'); $s_origin_school_id = $request->getParameter('escuela_procedencia_numero'); //domicilio $s_city = $this->getRequestParameter('domicilio_ciudad_id'); $s_street = $this->getRequestParameter('domicilio_calle'); $s_number = $this->getRequestParameter('domicilio_numero'); $s_floor = $this->getRequestParameter('domicilio_piso'); $s_flat = $this->getRequestParameter('domicilio_departamento'); //Chequeo tutor (madre) $m_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('madre_tipo_documento_id')); $m_identification_number = $this->getRequestParameter('madre_nro_documento'); $m_firstname = $this->getRequestParameter('madre_nombres'); $m_lastname = $this->getRequestParameter('madre_apellido'); $m_occupation = $this->getRequestParameter('madre_actividad_id'); $m_occupation_category = $this->getRequestParameter('madre_ocupacion_id'); $m_study = $this->getRequestParameter('madre_estudios_id'); $m_email = $this->getRequestParameter('madre_email'); $m_phone = $this->getRequestParameter('madre_telefono_celular'); $m_birthdate = $this->getRequestParameter('madre_fecha_nacimiento'); $m_birth_city = $this->getRequestParameter('madre_ciudad_nacimiento_id'); $m_nationality = $i_nationality->getNationality($this->getRequestParameter('madre_nacionalidad_id')); $m_is_alive = $this->getRequestParameter('madre_vive'); //chequeo is_alive if ($m_is_alive == 'S') { $m_is_alive = true; } elseif ($m_is_alive == 'N') { $m_is_alive = false; } //domicilio $m_city = $this->getRequestParameter('madre_domicilio_ciudad_id'); $m_street = $this->getRequestParameter('madre_domicilio_calle'); $m_number = $this->getRequestParameter('madre_domicilio_numero'); $m_floor = $this->getRequestParameter('madre_domicilio_piso'); $m_flat = $this->getRequestParameter('madre_domicilio_departamento'); //Chequeo tutor (padre) $p_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('padre_tipo_documento_id')); $p_identification_number = $this->getRequestParameter('padre_nro_documento'); $p_firstname = $this->getRequestParameter('padre_nombres'); $p_lastname = $this->getRequestParameter('padre_apellido'); $p_occupation = $this->getRequestParameter('padre_actividad_id'); $p_occupation_category = $this->getRequestParameter('padre_ocupacion_id'); $p_study = $this->getRequestParameter('padre_estudios_id'); $p_email = $this->getRequestParameter('padre_email'); $p_phone = $this->getRequestParameter('padre_telefono_celular'); $p_birthdate = $this->getRequestParameter('padre_fecha_nacimiento'); $p_birth_city = $this->getRequestParameter('padre_ciudad_nacimiento_id'); $p_nationality = $i_nationality->getNationality($this->getRequestParameter('padre_nacionalidad_id')); $p_is_alive = $this->getRequestParameter('padre_vive'); //chequeo is_alive if ($p_is_alive == 'S') { $p_is_alive = true; } elseif ($p_is_alive == 'N') { $p_is_alive = false; } //domicilio $p_city = $this->getRequestParameter('padre_domicilio_ciudad_id'); $p_street = $this->getRequestParameter('padre_domicilio_calle'); $p_number = $this->getRequestParameter('padre_domicilio_numero'); $p_floor = $this->getRequestParameter('padre_domicilio_piso'); $p_flat = $this->getRequestParameter('padre_domicilio_departamento'); $data = array(); //chequeo campos obligatorios if (is_null($s_identification_type) || is_null($s_identification_number) || is_null($s_lastname) || trim($s_lastname) == "" || is_null($s_firstname) || trim($s_firstname) == "" || is_null($s_sex)) { throw new Exception('Missing data'); } else { $con = Propel::getConnection(); try { //chequeo que el alumno no haya sido ingresado en un año anterior (por lista de espera) $student = StudentPeer::retrieveByDocumentTypeAndNumber($s_identification_type, $s_identification_number); $con->beginTransaction(); if (is_null($student)) { //el alumno no existe. Creo la persona y el alumno $s_person = new Person(); $s_person->setLastname($s_lastname); $s_person->setFirstname($s_firstname); $s_person->setSex($s_sex); $s_person->setIdentificationType($s_identification_type); $s_person->setIdentificationNumber($s_identification_number); $s_person->setPhone($s_phone); $s_person->setBirthdate($s_birthdate); $s_person->setIsActive(true); $s_person->setBirthCity($s_birth_city); $s_person->save(Propel::getConnection()); $student = new Student(); $student->setPerson($s_person); $student->setGlobalFileNumber('888888'); //Nro de legajo?? $student->setOriginSchoolId($s_origin_school_id); $student->setHealthCoverageId($s_health_coverage_id); $student->save(Propel::getConnection()); /* Recupero department, state ,country*/ if (!is_null($s_birth_city)) { $city = CityPeer::retrieveByPk($s_birth_city); $student->getPerson()->setBirthCountry($city->getDepartment()->getState()->getCountry()->getId()); $student->getPerson()->setBirthState($city->getDepartment()->getState()->getId()); $student->getPerson()->setBirthDepartment($city->getDepartment()->getId()); } //chequeo domicilio if (!is_null($s_city) || !is_null($s_street) || !is_null($s_number) || !is_null($s_floor) || is_null($s_flat)) { $a = new Address(); $a->setCityId($s_city); $a->setStreet($s_street); $a->setNumber($s_number); $a->setFloor($s_floor); $a->setFlat($s_flat); $student->getPerson()->setAddress($a); $student->getPerson()->save(Propel::getConnection()); $data['message'] = "El alumno ha sido confirmado."; } } else { //seteo isActive $student->getPerson()->setIsActive(true); $student->save(Propel::getConnection()); $data['message'] = "El alumno fue actualizado correctamente."; } //chequeo campos obligatorios if (!is_null($m_identification_type) && !is_null($m_identification_number) && !is_null($m_lastname) && trim($m_lastname) != "" && !is_null($m_firstname) && trim($m_firstname) != "") { //busco si ya existe. $m_tutor = TutorPeer::findByDocumentTypeAndNumber($m_identification_type, $m_identification_number); if (is_null($m_tutor)) { //el tutor no existe. Lo creo $m_person = new Person(); $m_person->setLastname($m_lastname); $m_person->setFirstname($m_firstname); $m_person->setIdentificationType($m_identification_type); $m_person->setIdentificationNumber($m_identification_number); $m_person->setSex(SexType::FEMALE); $m_person->setPhone($m_phone); $m_person->setEmail($m_email); $m_person->setBirthdate($m_birthdate); $m_person->setIsActive(true); $m_person->setBirthCity($m_birth_city); $m_person->save(Propel::getConnection()); $m_tutor = new Tutor(); $m_tutor->setPerson($m_person); $m_tutor->setOccupationId($m_occupation); $m_tutor->setOccupationCategoryId($m_occupation_category); $m_tutor->setStudyId($m_study); //coincide con la tabla sga_tipos_est_cur $m_tutor->setNationality($m_nationality); $m_tutor->setIsAlive($m_is_alive); $m_tutor->save(Propel::getConnection()); /* Recupero department, state ,country*/ if (!is_null($m_birth_city)) { $m_city = CityPeer::retrieveByPk($m_birth_city); $m_tutor->getPerson()->setBirthCountry($m_city->getDepartment()->getState()->getCountry()->getId()); $m_tutor->getPerson()->setBirthState($m_city->getDepartment()->getState()->getId()); $m_tutor->getPerson()->setBirthDepartment($m_city->getDepartment()->getId()); } //chequeo domicilio if (!is_null($m_city) || !is_null($m_street) || !is_null($m_number) || !is_null($m_floor) || is_null($m_flat)) { $a = new Address(); $a->setCityId($m_birth_city); $a->setStreet($m_street); $a->setNumber($m_number); $a->setFloor($m_floor); $a->setFlat($m_flat); $m_tutor->getPerson()->setAddress($a); $m_tutor->getPerson()->save(Propel::getConnection()); } } else { $data['info'] = "El tutor con " . $i_identification_type->getStringFor($m_identification_type) . " " . $m_identification_number; } $st = StudentTutorPeer::retrieveByStudentAndTutor($student, $m_tutor); if (is_null($st)) { //datos de tutor(madre) $student_tutor = new StudentTutor(); $student_tutor->setStudent($student); $student_tutor->setTutor($m_tutor); $student_tutor->save(Propel::getConnection()); $m_tutor->addStudentTutor($student_tutor); $m_tutor->save(Propel::getConnection()); } } //chequeo campos obligatorios if (!is_null($p_identification_type) && !is_null($p_identification_number) && !is_null($p_lastname) && trim($p_lastname) != "" && !is_null($p_firstname) && trim($p_firstname) != "") { //busco si ya existe. $tutor = TutorPeer::findByDocumentTypeAndNumber($p_identification_type, $p_identification_number); if (is_null($tutor)) { //el tutor no existe. Lo creo $p_person = new Person(); $p_person->setLastname($p_lastname); $p_person->setFirstname($p_firstname); $p_person->setIdentificationType($p_identification_type); $p_person->setIdentificationNumber($p_identification_number); $p_person->setSex(SexType::MALE); $p_person->setPhone($p_phone); $p_person->setEmail($p_email); $p_person->setBirthdate($p_birthdate); $p_person->setIsActive(true); $p_person->setBirthCity($p_birth_city); $p_person->save(Propel::getConnection()); $tutor = new Tutor(); $tutor->setPerson($p_person); $tutor->setOccupationId($p_occupation); $tutor->setOccupationCategoryId($p_occupation_category); $tutor->setStudyId($p_study); //coincide con la tabla sga_tipos_est_cur $tutor->setNationality($p_nationality); $tutor->save(Propel::getConnection()); /* Recupero department, state ,country*/ if (!is_null($p_birth_city)) { $p_city = CityPeer::retrieveByPk($p_birth_city); $tutor->getPerson()->setBirthCountry($p_city->getDepartment()->getState()->getCountry()->getId()); $tutor->getPerson()->setBirthState($p_city->getDepartment()->getState()->getId()); $tutor->getPerson()->setBirthDepartment($p_city->getDepartment()->getId()); } //chequeo domicilio if (!is_null($p_city) || !is_null($p_street) || !is_null($p_number) || !is_null($p_floor) || is_null($p_flat)) { $a = new Address(); $a->setCityId($p_birth_city); $a->setStreet($p_street); $a->setNumber($p_number); $a->setFloor($p_floor); $a->setFlat($p_flat); $tutor->getPerson()->setAddress($a); $tutor->getPerson()->save(Propel::getConnection()); } if (!is_null($data['info'])) { $data['info'] = $data['info'] . " ya existe en el sistema. Por favor actualice los datos."; } } else { if (!is_null($data['info'])) { $data['info'] = "Los tutores con " . $i_identification_type->getStringFor($m_identification_type) . " " . $m_identification_number . " y " . $i_identification_type->getStringFor($p_identification_type) . " " . $p_identification_number . " ya existen en el sistema. Por favor actualice los datos."; } else { $data['info'] = "El tutor con " . $i_identification_type->getStringFor($p_identification_type) . " " . $p_identification_number . " ya existe en el sistema. Por favor actualice los datos."; } } //datos de tutor(padre) $st = StudentTutorPeer::retrieveByStudentAndTutor($student, $tutor); if (is_null($st)) { $student_tutor = new StudentTutor(); $student_tutor->setStudent($student); $student_tutor->setTutor($tutor); $student_tutor->save(Propel::getConnection()); $tutor->addStudentTutor($student_tutor); $tutor->save(Propel::getConnection()); } } $con->commit(); } catch (PropelException $e) { $con->rollBack(); throw $e; } } $this->data = $data; $this->getResponse()->setHttpHeader('Content-type', 'application/json'); $this->getResponse()->setContent(json_encode($data)); $this->setLayout(false); }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @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(CityPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(CityPeer::DATABASE_NAME); $criteria->add(CityPeer::ID, $pks, Criteria::IN); $objs = CityPeer::doSelect($criteria, $con); } return $objs; }
public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } DistrictPeer::addSelectColumns($c); $startcol2 = DistrictPeer::NUM_COLUMNS - DistrictPeer::NUM_LAZY_LOAD_COLUMNS + 1; CityPeer::addSelectColumns($c); $startcol3 = $startcol2 + CityPeer::NUM_COLUMNS; $c->addJoin(DistrictPeer::CITY_ID, CityPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = DistrictPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = CityPeer::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->getCity(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addDistrict($obj1); break; } } if ($newObject) { $obj2->initDistricts(); $obj2->addDistrict($obj1); } $results[] = $obj1; } return $results; }
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; }
/** * Return the string representation for the birth city * * @return string */ public function getBirthCityRepresentation() { $criteria = new Criteria(); $criteria->add(CityPeer::ID, $this->getBirthCity()); $city = CityPeer::doSelectOne($criteria); if ($city) { return $city->getName(); } }
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; }