当前位置: 首页>>代码示例>>PHP>>正文


PHP Employee::setEmployeeId方法代码示例

本文整理汇总了PHP中Employee::setEmployeeId方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::setEmployeeId方法的具体用法?PHP Employee::setEmployeeId怎么用?PHP Employee::setEmployeeId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Employee的用法示例。


在下文中一共展示了Employee::setEmployeeId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetAccessibleEmployees

 public function testGetAccessibleEmployees()
 {
     $mockService = $this->getMock('EmployeeService');
     $employeeList = new Doctrine_Collection('Employee');
     for ($i = 0; $i < 2; $i++) {
         $employee = new Employee();
         $employee->setEmployeeId($i + 1);
         $employee->setEmpNumber($i + 1);
         $employee->setFirstName("test name" . $i + 1);
         $employeeList->add($employee);
     }
     $mockService->expects($this->once())->method('getSubordinateList')->with(1, true)->will($this->returnValue($employeeList));
     $this->supervisorUserRole->setEmployeeNumber(1);
     $this->supervisorUserRole->setEmployeeService($mockService);
     $employees = $this->supervisorUserRole->getAccessibleEmployees();
     $this->assertEquals(2, count($employees));
     for ($i = 0; $i < 2; $i++) {
         $this->assertEquals($employees[$i + 1], $employeeList[$i]);
     }
 }
开发者ID:THM068,项目名称:orangehrm,代码行数:20,代码来源:SupervisorUserRoleTest.php

示例2: searchEmployees

 /**
  * Get employee list after sorting and filtering using given parameters.
  *
  * @param EmployeeSearchParameterHolder $parameterHolder
  */
 public function searchEmployees(EmployeeSearchParameterHolder $parameterHolder)
 {
     $sortField = $parameterHolder->getOrderField();
     $sortOrder = $parameterHolder->getOrderBy();
     $offset = $parameterHolder->getOffset();
     $limit = $parameterHolder->getLimit();
     $filters = $parameterHolder->getFilters();
     $returnType = $parameterHolder->getReturnType();
     $select = '';
     $query = '';
     $bindParams = array();
     $orderBy = '';
     $this->_getEmployeeListQuery($select, $query, $bindParams, $orderBy, $sortField, $sortOrder, $filters);
     $completeQuery = $select . ' ' . $query . ' ' . $orderBy;
     if (!is_null($offset) && !is_null($limit)) {
         $completeQuery .= ' LIMIT ' . $offset . ', ' . $limit;
     }
     if (sfConfig::get('sf_logging_enabled')) {
         $msg = $completeQuery;
         if (count($bindParams) > 0) {
             $msg .= ' (' . implode(',', $bindParams) . ')';
         }
         sfContext::getInstance()->getLogger()->info($msg);
     }
     $conn = Doctrine_Manager::connection();
     $statement = $conn->prepare($completeQuery);
     $result = $statement->execute($bindParams);
     if ($returnType == EmployeeSearchParameterHolder::RETURN_TYPE_OBJECT) {
         $employees = new Doctrine_Collection(Doctrine::getTable('Employee'));
         if ($result) {
             while ($row = $statement->fetch()) {
                 $employee = new Employee();
                 $employee->setEmpNumber($row['empNumber']);
                 $employee->setEmployeeId($row['employeeId']);
                 $employee->setFirstName($row['firstName']);
                 $employee->setMiddleName($row['middleName']);
                 $employee->setLastName($row['lastName']);
                 $employee->setTerminationId($row['terminationId']);
                 $jobTitle = new JobTitle();
                 $jobTitle->setId($row['jobTitleId']);
                 $jobTitle->setJobTitleName($row['jobTitle']);
                 $jobTitle->setIsDeleted($row['isDeleted']);
                 $employee->setJobTitle($jobTitle);
                 $employeeStatus = new EmploymentStatus();
                 $employeeStatus->setId($row['employeeStatusId']);
                 $employeeStatus->setName($row['employeeStatus']);
                 $employee->setEmployeeStatus($employeeStatus);
                 $workStation = new SubUnit();
                 $workStation->setName($row['subDivision']);
                 $workStation->setId($row['subDivisionId']);
                 $employee->setSubDivision($workStation);
                 $supervisorList = isset($row['supervisors']) ? $row['supervisors'] : '';
                 if (!empty($supervisorList)) {
                     $supervisors = new Doctrine_Collection(Doctrine::getTable('Employee'));
                     $supervisorArray = explode(',', $supervisorList);
                     foreach ($supervisorArray as $supervisor) {
                         list($first, $middle, $last) = explode('##', $supervisor);
                         $supervisor = new Employee();
                         $supervisor->setFirstName($first);
                         $supervisor->setMiddleName($middle);
                         $supervisor->setLastName($last);
                         $employee->supervisors[] = $supervisor;
                     }
                 }
                 $locationList = $row['locationIds'];
                 if (!empty($locationList)) {
                     //                    $locations = new Doctrine_Collection(Doctrine::getTable('EmpLocations'));
                     $locationArray = explode(',', $locationList);
                     foreach ($locationArray as $location) {
                         list($id, $name) = explode('##', $location);
                         $empLocation = new Location();
                         $empLocation->setId($id);
                         $empLocation->setName($name);
                         $employee->locations[] = $empLocation;
                     }
                 }
                 $employees[] = $employee;
             }
         }
     } else {
         return $statement->fetchAll();
     }
     return $employees;
 }
开发者ID:CamilleCrespeau,项目名称:orangehrm,代码行数:89,代码来源:EmployeeDao.php

示例3: 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;
 }
开发者ID:rabbitdigital,项目名称:HRM,代码行数:93,代码来源:PimCsvDataImport.php

示例4: xtestGetEmployeeAllowedToApplyLeaveTypes

 public function xtestGetEmployeeAllowedToApplyLeaveTypes()
 {
     $leaveTypes = TestDataService::loadObjectList('LeaveType', $this->fixture, 'set5');
     //mocking LeaveTypeService
     $leaveTypeService = $this->getMock('LeaveTypeService', array('getLeaveTypeList'));
     $leaveTypeService->expects($this->once())->method('getLeaveTypeList')->will($this->returnValue($leaveTypes));
     $this->leaveRequestService->setLeaveTypeService($leaveTypeService);
     //mocking LeaveEntitlementService
     $leaveEntitlementService = $this->getMock('OldLeaveEntitlementService', array('getLeaveBalance'));
     $leaveEntitlementService->expects($this->any())->method('getLeaveBalance')->will($this->returnValue(2));
     $this->leaveRequestService->setLeaveEntitlementService($leaveEntitlementService);
     //mocking LeavePeriodService
     $leavePeriod = new LeavePeriod();
     $leavePeriod->setStartDate("2010-01-01");
     $leavePeriod->setEndDate("2010-12-31");
     $leavePeriod->setLeavePeriodId(1);
     $leavePeriodService = $this->getMock('LeavePeriodService', array('getCurrentLeavePeriod'));
     $leavePeriodService->expects($this->exactly(2))->method('getCurrentLeavePeriod')->will($this->returnValue($leavePeriod));
     $this->leaveRequestService->setLeavePeriodService($leavePeriodService);
     $employee = new Employee();
     $employee->setEmployeeId('0001');
     $result = $this->leaveRequestService->getEmployeeAllowedToApplyLeaveTypes($employee);
     $this->assertTrue(is_array($result));
     foreach ($result as $leaveType) {
         $this->assertTrue($leaveType instanceof LeaveType);
     }
     // Test handling of exceptions
     // Replace LeaveTypeService with mock that throws an exception
     $leaveTypeService = $this->getMock('LeaveTypeService', array('getLeaveTypeList'));
     $leaveTypeService->expects($this->once())->method('getLeaveTypeList')->will($this->throwException(new LeaveServiceException()));
     $this->leaveRequestService->setLeaveTypeService($leaveTypeService);
     try {
         $this->leaveRequestService->getEmployeeAllowedToApplyLeaveTypes($employee);
         $this->fail("Expected exception");
     } catch (LeaveServiceException $e) {
         // expected
     }
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:38,代码来源:LeaveRequestServiceTest.php

示例5: 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]);
     }
//.........这里部分代码省略.........
开发者ID:abdocmd,项目名称:orangehrm-3.0.1,代码行数:101,代码来源:PimCsvDataImport.php

示例6: testApplyLeaveFailLeaveOverlap

 /**
  * This test checks for the Leave Overlapping and failure in apply
  */
 public function testApplyLeaveFailLeaveOverlap()
 {
     // Set post parameters
     $parameters = array('txtFromDate' => '2010-11-23', 'txtToDate' => '2010-11-24', 'txtEmpID' => '0001', 'txtLeaveType' => 'LT001');
     $request = $this->context->request;
     $request->setPostParameters($parameters);
     // Set request to POST method
     $request->setMethod(sfRequest::POST);
     //mocking employee service
     $employeeService = $this->getMock('EmployeeService', array('getEmployee'));
     $employee = new Employee();
     $employee->setEmployeeId('0001');
     $employee->setFirstName("rand name");
     $employeeService->expects($this->once())->method('getEmployee')->will($this->returnValue($employee));
     //mocking LeaveRequestService
     $leaveRequestService = $this->getMock('LeaveRequestService', array('getEmployeeAllowedToApplyLeaveTypes', 'getOverlappingLeave'));
     $leaveTypes = TestDataService::loadObjectList('LeaveType', $this->fixture, 'LeaveTypes');
     $leaves = TestDataService::loadObjectList('Leave', $this->fixture, 'Leave');
     $leaveRequestService->expects($this->once())->method('getOverlappingLeave')->will($this->returnValue($leaves));
     $leaveRequestService->expects($this->once())->method('getEmployeeAllowedToApplyLeaveTypes')->will($this->returnValue($leaveTypes));
     $applyLeaveAction = new applyLeaveAction($this->context, "leave", "execute");
     $applyLeaveAction->setEmployeeNumber('0001');
     $applyLeaveAction->setEmployeeService($employeeService);
     $applyLeaveAction->setLeaveRequestService($leaveRequestService);
     //mocking the form
     $form = $this->getMock('ApplyLeaveForm', array('isValid'));
     $form->expects($this->once())->method('isValid')->will($this->returnValue(true));
     $applyLeaveAction->setForm($form);
     try {
         $applyLeaveAction->execute($request);
         $this->assertTrue(!isset($applyLeaveAction->templateMessage['SUCCESS']));
         $this->assertTrue(isset($applyLeaveAction->overlapLeaves));
     } catch (Exception $e) {
     }
 }
开发者ID:THM068,项目名称:orangehrm,代码行数:38,代码来源:ApplyLeaveActionTest.php


注:本文中的Employee::setEmployeeId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。