| @@ -511,29 +511,41 @@ | ||
| 511 | 511 | |
| 512 | 512 | return $ret; |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | - public function findEmployeeByUserId( $userId ) | |
| 515 | + public function findEmployeeByUser( HC3_Users_Model $user ) | |
| 516 | 516 | { |
| 517 | 517 | $ret = null; |
| 518 | + | |
| 519 | + $userId = $user->getId(); | |
| 518 | 520 | if( ! $userId ){ |
| 519 | 521 | return $ret; |
| 520 | 522 | } |
| 521 | 523 | |
| 522 | 524 | $employeeId = isset( $this->repoUserEmployee[$userId] ) ? $this->repoUserEmployee[$userId] : null; |
| 525 | + | |
| 526 | + // $crud = $this->crudFactory->make('employee'); | |
| 527 | + // $args = array(); | |
| 528 | + // $args[] = array('user_id', '=', $userId ); | |
| 529 | + // $results = $crud->read( $args ); | |
| 530 | + | |
| 531 | + // if( ! $results ){ | |
| 532 | + // return $ret; | |
| 533 | + // } | |
| 534 | + | |
| 535 | + // $results = array_shift( $results ); | |
| 536 | + // $employeeId = array_key_exists('id', $results) ? $results['id'] : null; | |
| 537 | + | |
| 523 | 538 | if( ! $employeeId ){ |
| 524 | 539 | return $ret; |
| 525 | 540 | } |
| 526 | 541 | |
| 542 | + // $ret = $this->employeesQuery->findById( $employeeId ); | |
| 543 | + | |
| 527 | 544 | if( ! isset($this->repoEmployee[$employeeId]) ){ |
| 528 | 545 | $this->repoEmployee[$employeeId] = $this->employeesQuery->findById( $employeeId ); |
| 529 | 546 | } |
| 530 | - $ret = $this->repoEmployee[$employeeId]; | |
| 547 | + $ret = $this->repoEmployee[$employeeId]; | |
| 531 | 548 | |
| 532 | 549 | return $ret; |
| 533 | - } | |
| 534 | - | |
| 535 | - public function findEmployeeByUser( HC3_Users_Model $user ) | |
| 536 | - { | |
| 537 | - return $this->self->findEmployeeByUserId( $user->getId() ); | |
| 538 | 550 | } |
| 539 | 551 | } |