本文整理汇总了PHP中JobPeer::getByName方法的典型用法代码示例。如果您正苦于以下问题:PHP JobPeer::getByName方法的具体用法?PHP JobPeer::getByName怎么用?PHP JobPeer::getByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JobPeer
的用法示例。
在下文中一共展示了JobPeer::getByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
//.........这里部分代码省略.........
$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