From 40258fc10b8ca66b6682b29e91f8fffa77bf9e05 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 31 Dec 2019 19:54:45 +0100 Subject: [PATCH] add todos from github --- Controller/ApiController.php | 3 +-- Models/Employee.php | 6 +++++- Models/EmployeeHistory.php | 21 +++------------------ 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 46ce083..c0e4279 100644 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -259,8 +259,7 @@ final class ApiController extends Controller */ private function createEmployeeHistoryFromRequest(RequestAbstract $request) : EmployeeHistory { - $history = new EmployeeHistory(); - $history->setEmployee((int) ($request->getData('employee') ?? 0)); + $history = new EmployeeHistory((int) ($request->getData('employee') ?? 0)); $history->setUnit((int) ($request->getData('unit') ?? 0)); $history->setDepartment((int) ($request->getData('department') ?? 0)); $history->setPosition((int) ($request->getData('position') ?? 0)); diff --git a/Models/Employee.php b/Models/Employee.php index 398138e..d8a70c0 100644 --- a/Models/Employee.php +++ b/Models/Employee.php @@ -62,7 +62,8 @@ class Employee implements ArrayableInterface, \JsonSerializable /** * Employee education history. * - * @todo: implement! + * @todo Orange-Management/Modules#187 + * Implement the education history for an employee. This can be done similarly to the company history. * * @var array * @since 1.0.0 @@ -72,6 +73,9 @@ class Employee implements ArrayableInterface, \JsonSerializable /** * Employee external work history. * + * @todo Orange-Management/Modules#188 + * Implement the work history (at other companies) for an employee. This can be done similarly to the company history. + * * @var array * @since 1.0.0 */ diff --git a/Models/EmployeeHistory.php b/Models/EmployeeHistory.php index 2d0df58..2118e70 100644 --- a/Models/EmployeeHistory.php +++ b/Models/EmployeeHistory.php @@ -94,9 +94,10 @@ class EmployeeHistory implements ArrayableInterface, \JsonSerializable * * @since 1.0.0 */ - public function __construct() + public function __construct($employee = 0) { - $this->start = new \DateTime('now'); + $this->employee = $employee; + $this->start = new \DateTime('now'); } /** @@ -123,22 +124,6 @@ class EmployeeHistory implements ArrayableInterface, \JsonSerializable return empty($this->employee) ? new NullEmployee() : $this->employee; } - /** - * Set the employee - * - * @param int|Employee $employee Employee - * - * @return void - * - * @todo maybe only do this in the constructor - * - * @since 1.0.0 - */ - public function setEmployee($employee) : void - { - $this->employee = $employee; - } - /** * Get the position *