From b2e4070153b42673f60712e6602b1b2a2ed07e32 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 21 Feb 2016 10:09:54 +0100 Subject: [PATCH] Started to implement employee model --- Admin/Installer.php | 1 - Models/Employee.php | 22 +++------------ Models/EmployeeMapper.php | 57 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 20 deletions(-) create mode 100644 Models/EmployeeMapper.php diff --git a/Admin/Installer.php b/Admin/Installer.php index 56ccb5c..9bcef0e 100644 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -45,7 +45,6 @@ class Installer extends InstallerAbstract $dbPool->get('core')->con->prepare( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'hr_staff` ( `hr_staff_id` int(11) NOT NULL AUTO_INCREMENT, - `hr_staff_status` tinyint(2) DEFAULT NULL, `hr_staff_account` int(11) DEFAULT NULL, PRIMARY KEY (`hr_staff_id`), KEY `hr_staff_account` (`hr_staff_account`) diff --git a/Models/Employee.php b/Models/Employee.php index ac756f3..266501d 100644 --- a/Models/Employee.php +++ b/Models/Employee.php @@ -15,8 +15,7 @@ */ namespace Modules\HumanResources\Models; -use phpOMS\Models\User\User; -use phpOMS\Pattern\Multition; +use Modules\Admin\Models\Account; /** * Employee class. @@ -29,8 +28,7 @@ use phpOMS\Pattern\Multition; * @link http://orange-management.com * @since 1.0.0 */ -class Employee implements Multition -{ +class Employee extends Account { /** * Employee ID. @@ -38,21 +36,7 @@ class Employee implements Multition * @var int * @since 1.0.0 */ - private $id = null; - - /** - * User. - * - * @var User - * @since 1.0.0 - */ - private $user = null; - - private static $instances = []; - - public function __construct($id) - { - } + private $employeeId = 0; public function getInstance($id) { diff --git a/Models/EmployeeMapper.php b/Models/EmployeeMapper.php new file mode 100644 index 0000000..4ecb4a5 --- /dev/null +++ b/Models/EmployeeMapper.php @@ -0,0 +1,57 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Admin\Models; + +use phpOMS\DataStorage\Database\DataMapperAbstract; + +class EmployeeMapper extends AccountMapper +{ + + /** + * Columns. + * + * @var array + * @since 1.0.0 + */ + protected static $columns = [ + 'hr_staff_id' => ['name' => 'account_id', 'type' => 'int', 'internal' => 'id'], + 'hr_staff' => ['name' => 'account_status', 'type' => 'int', 'internal' => 'status'], + ]; + + /** + * Primary table. + * + * @var string + * @since 1.0.0 + */ + protected static $table = 'hr_staff'; + + /** + * Primary field name. + * + * @var string + * @since 1.0.0 + */ + protected static $primaryField = 'hr_staff_id'; + + /** + * Overwriting extended + * + * @var bool + * @since 1.0.0 + */ + protected static $overwrite = false; +}