public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } SubdistrictPeer::addSelectColumns($c); $startcol2 = SubdistrictPeer::NUM_COLUMNS - SubdistrictPeer::NUM_LAZY_LOAD_COLUMNS + 1; DistrictPeer::addSelectColumns($c); $startcol3 = $startcol2 + DistrictPeer::NUM_COLUMNS; $c->addJoin(SubdistrictPeer::DISTRICT_ID, DistrictPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = SubdistrictPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = DistrictPeer::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->getDistrict(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addSubdistrict($obj1); break; } } if ($newObject) { $obj2->initSubdistricts(); $obj2->addSubdistrict($obj1); } $results[] = $obj1; } return $results; }
public function countDistricts($criteria = null, $distinct = false, $con = null) { include_once 'lib/model/om/BaseDistrictPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(DistrictPeer::CITY_ID, $this->getId()); return DistrictPeer::doCount($criteria, $distinct, $con); }
public function getDistrict($con = null) { include_once 'lib/model/om/BaseDistrictPeer.php'; if ($this->aDistrict === null && $this->district_id !== null) { $this->aDistrict = DistrictPeer::retrieveByPK($this->district_id, $con); } return $this->aDistrict; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = DistrictPeer::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->setCityId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setCreated($arr[$keys[3]]); } }
protected function execute($arguments = array(), $options = array()) { // initialize the database connection $databaseManager = new sfDatabaseManager($this->configuration); $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection(); // create connection to import database $this->logSection('connection', 'creating connection to import source'); $source = Propel::getConnection($options['source'] ? $options['source'] : null); // create static counties and offices $this->logSection('static', 'creating static counties and offices'); $connection->beginTransaction(); try { OfficePeer::doDeleteAll($connection); $o1 = new Office(); $o1->setName('Plattsburgh'); $o1->save($connection); $o1 = new Office(); $o1->setName('Rouses Point'); $o1->save($connection); CountyPeer::doDeleteAll($connection); $c1 = new County(); $c1->setName('Clinton'); $c1->save($connection); $c1 = new County(); $c1->setName('Essex'); $c1->save($connection); $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // read in and create objects for district, frequency, icd9, job, services tables // DISTRICT $query = 'SELECT * FROM %s'; $query = sprintf($query, 'tbl_district'); $statement = $source->prepare($query); $statement->execute(); $districts = $statement->fetchAll(); $connection->beginTransaction(); try { DistrictPeer::doDeleteAll($connection); foreach ($districts as $district) { $this->logSection('district', 'creating district ' . $district['district_name']); $d1 = new District(); $d1->setName($district['district_name']); $d1->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // FREQUENCY $query = 'SELECT * FROM %s'; $query = sprintf($query, 'tbl_frequency'); $statement = $source->prepare($query); $statement->execute(); $frequencies = $statement->fetchAll(); $connection->beginTransaction(); try { FrequencyPeer::doDeleteAll($connection); foreach ($frequencies as $freq) { $this->logSection('freq', 'reading frequency ' . $freq['freq_title']); $f1 = new Frequency(); $f1->setName($freq['freq_title']); $f1->setDescription($freq['freq_description']); $f1->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // ICD9 $query = 'SELECT * FROM %s'; $query = sprintf($query, 'tbl_icd9'); $statement = $source->prepare($query); $statement->execute(); $icd9s = $statement->fetchAll(); $connection->beginTransaction(); try { Icd9Peer::doDeleteAll($connection); foreach ($icd9s as $icd9) { $this->logSection('icd9', 'reading icd9 ' . $icd9['icd9_value']); $i1 = new Icd9(); $i1->setName($icd9['icd9_value']); $i1->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // JOB $query = 'SELECT * FROM %s'; $query = sprintf($query, 'tbl_job'); $statement = $source->prepare($query); $statement->execute(); $jobs = $statement->fetchAll(); $connection->beginTransaction(); try { JobPeer::doDeleteAll($connection); foreach ($jobs as $job) { $this->logSection('job', 'reading job ' . $job['job_title']); $j1 = new Job(); $j1->setName($job['job_title']); $j1->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // SERVICES $query = 'SELECT * FROM %s'; $query = sprintf($query, 'tbl_services'); $statement = $source->prepare($query); $statement->execute(); $services = $statement->fetchAll(); $connection->beginTransaction(); try { ServicePeer::doDeleteAll($connection); foreach ($services as $service) { $this->logSection('service', 'reading service ' . $service['service_title']); $s1 = new Service(); $s1->setName($service['service_title']); $s1->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // EMPLOYEES $query = 'SELECT * FROM %s LEFT JOIN (%s) ON (%s.emp_job_title = %s.job_id)'; $query = sprintf($query, 'tbl_employee', 'tbl_job', 'tbl_employee', 'tbl_job'); $statement = $source->prepare($query); $statement->execute(); $employees = $statement->fetchAll(); $connection->beginTransaction(); try { EmployeePeer::doDeleteAll($connection); foreach ($employees as $employee) { $this->logSection('employee', 'reading employee ' . $employee['emp_id']); $emp = new Employee(); $emp_fields = array('clearance' => $employee['emp_scr_clearance'], 'first_name' => $employee['emp_fn'], 'middle' => $employee['emp_mi'], 'last_name' => $employee['emp_ln'], 'address' => $employee['emp_address'], 'address_2' => $employee['emp_address2'], 'city' => $employee['emp_city'], 'state' => $employee['emp_state'], 'zip' => $employee['emp_zip'], 'home_phone' => $employee['emp_phone'], 'cell_phone' => $employee['emp_cell'], 'company_email' => $employee['emp_email'], 'personal_email' => $employee['emp_p_email'], 'license_number' => $employee['emp_license_number'], 'license_expiration' => $employee['emp_license_exp'], 'dob' => $employee['emp_dob'], 'doh' => $employee['emp_hire_date'], 'dof' => $employee['emp_end_date'], 'ssn' => $employee['emp_ssn'], 'health_insurance' => $employee['emp_health'], 'retirement_plan' => $employee['emp_401k'], 'suplimental_health' => $employee['emp_health_sup'], 'health_type' => $employee['emp_health_type'], 'tb_date' => $employee['emp_tb'], 'osha_date' => $employee['emp_osha'], 'cpr_date' => $employee['emp_cpr'], 'finger_prints' => $employee['emp_fp'], 'finger_print_notes' => $employee['emp_fp_n'], 'notes' => $employee['emp_notes']); $emp->fromArray($emp_fields, BasePeer::TYPE_FIELDNAME); // find the job - check for errors $emp->setJob(JobPeer::getByName($employee['job_title'])); // if physical has a date then create a new physical object for employee if ($employee['emp_physical']) { $this->logSection('physical', 'employee ' . $employee['emp_fn'] . ' had a physical on ' . $employee['emp_physical']); $ph1 = new Physical(); $ph1->setEmployee($emp); $ph1->setDateGiven($employee['emp_physical']); $ph1->save($connection); } $emp->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // read in and create client objects - linking to employee // CLIENTS $query = 'SELECT * FROM %s LEFT JOIN (%s) ON (%s.client_district = %s.district_id)'; $query = sprintf($query, 'tbl_client', 'tbl_district', 'tbl_client', 'tbl_district'); $statement = $source->prepare($query); $statement->execute(); $clients = $statement->fetchAll(); $connection->beginTransaction(); try { ClientPeer::doDeleteAll($connection); foreach ($clients as $client) { $this->logSection('client', 'reading client ' . $client['client_ln']); $cl = new Client(); $client_fields = array('first_name' => $client['client_fn'], 'last_name' => $client['client_ln'], 'dob' => $client['client_dob'], 'parent_first' => $client['client_parent_fn'], 'parent_last' => $client['client_parent_ln'], 'address' => $client['client_address'], 'address_2' => $client['client_address2'], 'city' => $client['client_city'], 'state' => $client['client_state'], 'zip' => $client['client_zip'], 'home_phone' => $client['home_phone'], 'work_phone' => $client['work_phone'], 'cell_phone' => $client['cell_phone'], 'blue_card' => $client['blue_card'], 'physical_exp' => $client['physical_exp_date'], 'immunizations' => $client['immunizations'], 'waiting_list' => $client['waiting_list']); // county $cl->setCounty(CountyPeer::getByName($client['client_county'])); // district $cl->setDistrict(DistrictPeer::getByName($client['district_name'])); $cl->fromArray($client_fields, BasePeer::TYPE_FIELDNAME); $cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // CLIENT SERVICES // CLASSROOM $query = 'SELECT * FROM tbl_classroom LEFT JOIN (tbl_client) ON (tbl_classroom.class_client_id = tbl_client.client_id) LEFT JOIN (tbl_employee) ON (tbl_classroom.class_provider_id = tbl_employee.emp_id) LEFT JOIN (tbl_services) ON (tbl_classroom.class_service_id = tbl_services.service_id) LEFT JOIN (tbl_frequency) ON (tbl_classroom.class_freq_id = tbl_frequency.freq_id)'; $statement = $source->prepare($query); $statement->execute(); $classrooms = $statement->fetchAll(); $connection->beginTransaction(); $c = new Criteria(); $c->add(ClientServicePeer::OBJECT_TYPE, ClientServicePeer::CLASSKEY_CLASSROOM); try { ClientServicePeer::doDelete($c, $connection); foreach ($classrooms as $classroom) { $this->logSection('classroom', 'reading service ' . $classroom['class_id']); $cr_cl = new Classroom(); $cr_cl->setStartDate($classroom['class_start_date']); $cr_cl->setEndDate($classroom['class_exp_date']); $cr_cl->setChangeDate($classroom['class_chng_date']); $cr_cl->setNotes($classroom['class_notes']); // client $cr_cl->setClient(ClientPeer::getByFullName($classroom['client_fn'], $classroom['client_ln'])); // employee $cr_cl->setEmployee(EmployeePeer::getByFullName($classroom['emp_fn'], $classroom['emp_ln'])); // service $cr_cl->setService(ServicePeer::getByName($classroom['service_title'])); // frequency $cr_cl->setFrequency(FrequencyPeer::getByName($classroom['freq_title'])); // office $cr_cl->setOffice(OfficePeer::getByName($classroom['class_location'])); $cr_cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // EI $query = 'SELECT * FROM tbl_ei LEFT JOIN (tbl_client) ON (tbl_ei.ei_client_id = tbl_client.client_id) LEFT JOIN (tbl_employee) ON (tbl_ei.ei_provider_id = tbl_employee.emp_id) LEFT JOIN (tbl_services) ON (tbl_ei.ei_service_id = tbl_services.service_id) LEFT JOIN (tbl_frequency) ON (tbl_ei.ei_freq_id = tbl_frequency.freq_id) LEFT JOIN (tbl_icd9) ON (tbl_ei.ei_icd9_id = tbl_icd9.icd9_id)'; $statement = $source->prepare($query); $statement->execute(); $eis = $statement->fetchAll(); $connection->beginTransaction(); $c = new Criteria(); $c->add(ClientServicePeer::OBJECT_TYPE, ClientServicePeer::CLASSKEY_EI); try { ClientServicePeer::doDelete($c, $connection); foreach ($eis as $ei) { $this->logSection('ei', 'reading service ' . $ei['ei_id']); $ei_cl = new Ei(); $ei_cl->setStartDate($ei['ei_start_date']); $ei_cl->setEndDate($ei['ei_exp_date']); $ei_cl->setChangeDate($ei['ei_chng_date']); $ei_cl->setNotes($ei['ei_serv_notes']); $ei_cl->setAuthorization($ei['ei_auth']); $ei_cl->setPhysiciansOrder($ei['ei_p_order']); // client $ei_cl->setClient(ClientPeer::getByFullName($ei['client_fn'], $ei['client_ln'])); // employee $ei_cl->setEmployee(EmployeePeer::getByFullName($ei['emp_fn'], $ei['emp_ln'])); // service $ei_cl->setService(ServicePeer::getByName($ei['service_title'])); // frequency $ei_cl->setFrequency(FrequencyPeer::getByName($ei['freq_title'])); // office $ei_cl->setIcd9(Icd9Peer::getByName($ei['icd9_value'])); $ei_cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // PRESCHOOL $query = 'SELECT * FROM tbl_preschool LEFT JOIN (tbl_client) ON (tbl_preschool.pre_client_id = tbl_client.client_id) LEFT JOIN (tbl_employee) ON (tbl_preschool.pre_provider_id = tbl_employee.emp_id) LEFT JOIN (tbl_services) ON (tbl_preschool.pre_service_id = tbl_services.service_id) LEFT JOIN (tbl_frequency) ON (tbl_preschool.pre_freq_id = tbl_frequency.freq_id)'; $statement = $source->prepare($query); $statement->execute(); $preschools = $statement->fetchAll(); $connection->beginTransaction(); $c = new Criteria(); $c->add(ClientServicePeer::OBJECT_TYPE, ClientServicePeer::CLASSKEY_PRESCHOOL); try { ClientServicePeer::doDelete($c, $connection); foreach ($preschools as $preschool) { $this->logSection('preschool', 'reading service ' . $preschool['pre_id']); $pr_cl = new Preschool(); $pr_cl->setStartDate($preschool['pre_start_date']); $pr_cl->setEndDate($preschool['pre_exp_date']); $pr_cl->setChangeDate($preschool['pre_chng_date']); // client $pr_cl->setClient(ClientPeer::getByFullName($preschool['client_fn'], $preschool['client_ln'])); // employee $pr_cl->setEmployee(EmployeePeer::getByFullName($preschool['emp_fn'], $preschool['emp_ln'])); // service $pr_cl->setService(ServicePeer::getByName($preschool['service_title'])); // frequency $pr_cl->setFrequency(FrequencyPeer::getByName($preschool['freq_title'])); $pr_cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // SEIT $query = 'SELECT * FROM tbl_seit LEFT JOIN (tbl_client) ON (tbl_seit.seit_client_id = tbl_client.client_id) LEFT JOIN (tbl_employee) ON (tbl_seit.seit_provider_id = tbl_employee.emp_id) LEFT JOIN (tbl_services) ON (tbl_seit.seit_service_id = tbl_services.service_id) LEFT JOIN (tbl_frequency) ON (tbl_seit.seit_freq_id = tbl_frequency.freq_id)'; $statement = $source->prepare($query); $statement->execute(); $seits = $statement->fetchAll(); $connection->beginTransaction(); $c = new Criteria(); $c->add(ClientServicePeer::OBJECT_TYPE, ClientServicePeer::CLASSKEY_SEIT); try { ClientServicePeer::doDelete($c, $connection); foreach ($seits as $seit) { $this->logSection('seit', 'reading service ' . $seit['seit_id']); $seit_cl = new Seit(); $seit_cl->setStartDate($seit['seit_start_date']); $seit_cl->setEndDate($seit['seit_exp_date']); $seit_cl->setChangeDate($seit['seit_chng_date']); $seit_cl->setNotes($seit['seit_notes']); // client $seit_cl->setClient(ClientPeer::getByFullName($seit['client_fn'], $seit['client_ln'])); // employee $seit_cl->setEmployee(EmployeePeer::getByFullName($seit['emp_fn'], $seit['emp_ln'])); // service $seit_cl->setService(ServicePeer::getByName($seit['service_title'])); // frequency $seit_cl->setFrequency(FrequencyPeer::getByName($seit['freq_title'])); $seit_cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } }
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(DistrictPeer::ID, $pks, Criteria::IN); $objs = DistrictPeer::doSelect($criteria, $con); } return $objs; }
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 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; }