本文整理汇总了PHP中Employee::setStreet1方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::setStreet1方法的具体用法?PHP Employee::setStreet1怎么用?PHP Employee::setStreet1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Employee
的用法示例。
在下文中一共展示了Employee::setStreet1方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
public function import($data)
{
if ($data[0] == "" || $data[2] == "" || strlen($data[0]) > 30 || strlen($data[2]) > 30) {
return false;
}
$employee = new Employee();
$employee->setFirstName($data[0]);
if (strlen($data[1]) <= 30) {
$employee->setMiddleName($data[1]);
}
$employee->setLastName($data[2]);
if (strlen($data[3]) <= 50) {
$employee->setEmployeeId($data[3]);
}
if (strlen($data[4]) <= 30) {
$employee->setOtherId($data[4]);
}
if (strlen($data[5]) <= 30) {
$employee->setLicenseNo($data[5]);
}
if ($this->isValidDate($data[6])) {
$employee->setEmpDriLiceExpDate($data[6]);
}
if (strtolower($data[7]) == 'male') {
$employee->setEmpGender('1');
} else {
if (strtolower($data[7]) == 'female') {
$employee->setEmpGender('2');
}
}
if (strtolower($data[8]) == 'single') {
$employee->setEmpMaritalStatus('Single');
} else {
if (strtolower($data[8]) == 'married') {
$employee->setEmpMaritalStatus('Married');
} else {
if (strtolower($data[8]) == 'other') {
$employee->setEmpMaritalStatus('Other');
}
}
}
$nationality = $this->isValidNationality($data[9]);
if (!empty($nationality)) {
$employee->setNationality($nationality);
}
if ($this->isValidDate($data[10])) {
$employee->setEmpBirthday($data[10]);
}
if (strlen($data[11]) <= 70) {
$employee->setStreet1($data[11]);
}
if (strlen($data[12]) <= 70) {
$employee->setStreet2($data[12]);
}
if (strlen($data[13]) <= 70) {
$employee->setCity($data[13]);
}
if (strlen($data[15]) <= 10) {
$employee->setEmpZipcode($data[15]);
}
$code = $this->isValidCountry($data[16]);
if (!empty($code)) {
$employee->setCountry($code);
if (strtolower($data[16]) == 'united states') {
$code = $this->isValidProvince($data[14]);
if (!empty($code)) {
$employee->setProvince($code);
}
} else {
if (strlen($data[14]) <= 70) {
$employee->setProvince($data[14]);
}
}
}
if (strlen($data[17]) <= 25 && $this->isValidPhoneNumber($data[17])) {
$employee->setEmpHmTelephone($data[17]);
}
if (strlen($data[18]) <= 25 && $this->isValidPhoneNumber($data[18])) {
$employee->setEmpMobile($data[18]);
}
if (strlen($data[19]) <= 25 && $this->isValidPhoneNumber($data[19])) {
$employee->setEmpWorkTelephone($data[19]);
}
if ($this->isValidEmail($data[20]) && strlen($data[20]) <= 50 && $this->isUniqueEmail($data[20])) {
$employee->setEmpWorkEmail($data[20]);
}
if ($this->isValidEmail($data[21]) && strlen($data[21]) <= 50 && $this->isUniqueEmail($data[21])) {
$employee->setEmpOthEmail($data[21]);
}
$empService = new EmployeeService();
$empService->addEmployee($employee);
return true;
}
示例2: testSaveContactDetails
/**
* Testing saveContactDetails
*/
public function testSaveContactDetails()
{
$empNumber = 121;
$employee = new Employee();
$employee->setLastName('Last Name');
$employee->setFirstName('First Name');
$employee->setStreet1('Main Street');
$employee->setStreet2('Suite 299');
$employee->setCity('Houston');
$employee->setProvince('Texas');
$employee->setEmpZipcode('928282');
$employee->setEmpHmTelephone('2998288288');
$employee->setEmpMobile('28882882');
$mockDao = $this->getMock('EmployeeDao');
$mockDao->expects($this->once())->method('saveContactDetails')->with($employee)->will($this->returnValue(true));
$this->employeeService->setEmployeeDao($mockDao);
$result = $this->employeeService->saveContactDetails($employee);
$this->assertTrue($result);
$mockDao = $this->getMock('EmployeeDao');
$mockDao->expects($this->once())->method('saveContactDetails')->with($employee)->will($this->throwException(new DaoException()));
$this->employeeService->setEmployeeDao($mockDao);
try {
$result = $this->employeeService->saveContactDetails($employee);
$this->fail("Exception expected");
} catch (Exception $e) {
$this->assertTrue($e instanceof PIMServiceException);
}
}
示例3: import
public function import($data)
{
set_time_limit(90);
if ($data[0] == "" || strlen($data[0]) > 30) {
return false;
}
$createUser = false;
$empService = new EmployeeService();
$employee = $empService->getEmployeeByEmployeeId($data[0]);
if (empty($employee)) {
$employee = new Employee();
$createUser = true;
}
if (strlen($data[0]) <= 50) {
$employee->setEmployeeId($data[0]);
}
$employee->setFirstName($data[1]);
if (strlen($data[2]) <= 30) {
$employee->setMiddleName($data[2]);
}
$employee->setLastName($data[3]);
if (strlen($data[4]) <= 30) {
$employee->setOtherId($data[4]);
}
if (strlen($data[5]) <= 30) {
$employee->setBloodGroup($data[5]);
}
if ($data[6] != "") {
$dob = $this->formatDate($data[6]);
$employee->setEmpBirthday($dob);
}
if (strtolower($data[7]) == 'male') {
$employee->setEmpGender('1');
} else {
if (strtolower($data[7]) == 'female') {
$employee->setEmpGender('2');
}
}
if (strtolower($data[8]) == 'single') {
$employee->setEmpMaritalStatus('Single');
} else {
if (strtolower($data[8]) == 'married') {
$employee->setEmpMaritalStatus('Married');
} else {
if (strtolower($data[8]) == 'other') {
$employee->setEmpMaritalStatus('Other');
}
}
}
$nationality = $this->isValidNationality($data[9]);
if (!empty($nationality)) {
$employee->setNationality($nationality);
}
if (strlen($data[10]) <= 70) {
$employee->setFatherName($data[10]);
}
if (strlen($data[11]) <= 70) {
$employee->setHusbandName($data[11]);
}
if (strlen($data[12]) <= 70) {
$employee->setStreet1($data[12]);
}
if (strlen($data[13]) <= 70) {
$employee->setStreet2($data[13]);
}
if (strlen($data[14]) <= 70) {
$employee->setCity($data[14]);
}
if (strlen($data[16]) <= 10) {
$employee->setEmpZipcode($data[16]);
}
$code = $this->isValidCountry($data[17]);
if (!empty($code)) {
$employee->setCountry($code);
if (strtolower($data[17]) == 'united states') {
$code = $this->isValidProvince($data[15]);
if (!empty($code)) {
$employee->setProvince($code);
}
} else {
if (strlen($data[15]) <= 70) {
$employee->setProvince($data[15]);
}
}
}
if (strlen($data[18]) <= 100) {
$employee->setPermanentAddress($data[18]);
}
if ($this->isValidEmail($data[19]) && strlen($data[19]) <= 50 && $this->isUniqueEmail($data[19])) {
$employee->setEmpWorkEmail($data[19]);
}
if ($this->isValidEmail($data[20]) && strlen($data[20]) <= 50) {
$employee->setEmpOthEmail($data[20]);
}
if ($this->isValidEmail($data[21]) && strlen($data[21]) <= 50) {
$employee->setEmpPersonalEmail($data[21]);
}
if (strlen($data[22]) <= 25 && $this->isValidPhoneNumber($data[22])) {
$employee->setEmpMobile($data[22]);
}
//.........这里部分代码省略.........