Employee preparation

This commit is contained in:
Dennis Eichhorn 2016-03-05 19:44:23 +01:00
parent b2e4070153
commit dea6bd0e2e
2 changed files with 27 additions and 76 deletions

View File

@ -28,7 +28,7 @@ use Modules\Admin\Models\Account;
* @link http://orange-management.com * @link http://orange-management.com
* @since 1.0.0 * @since 1.0.0
*/ */
class Employee extends Account { class Employee {
/** /**
* Employee ID. * Employee ID.
@ -36,73 +36,16 @@ class Employee extends Account {
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
private $employeeId = 0; private $id = 0;
public function getInstance($id) private $account = null;
public function setAccount(Account $account)
{ {
if (!isset(self::$instances[$id])) { $this->account = $account;
self::$instances[$id] = new self($id);
}
return self::$instances[$id];
} }
/** public function getAccount() : Account {
* {@inheritdoc} return $this->account;
*/
public function init($id)
{
}
/**
* {@inheritdoc}
*/
public function __clone()
{
}
public function setUser($id)
{
$this->user = new User($id);
}
/**
* {@inheritdoc}
*/
public function serialize()
{
// TODO: Implement serialize() method.
}
/**
* {@inheritdoc}
*/
public function unserialize($serialized)
{
// TODO: Implement unserialize() method.
}
/**
* {@inheritdoc}
*/
public function delete()
{
// TODO: Implement delete() method.
}
/**
* {@inheritdoc}
*/
public function create()
{
// TODO: Implement create() method.
}
/**
* {@inheritdoc}
*/
public function update()
{
// TODO: Implement update() method.
} }
} }

View File

@ -17,7 +17,7 @@ namespace Modules\Admin\Models;
use phpOMS\DataStorage\Database\DataMapperAbstract; use phpOMS\DataStorage\Database\DataMapperAbstract;
class EmployeeMapper extends AccountMapper class EmployeeMapper
{ {
/** /**
@ -27,8 +27,24 @@ class EmployeeMapper extends AccountMapper
* @since 1.0.0 * @since 1.0.0
*/ */
protected static $columns = [ protected static $columns = [
'hr_staff_id' => ['name' => 'account_id', 'type' => 'int', 'internal' => 'id'], 'hr_staff_id' => ['name' => 'hr_staff_id', 'type' => 'int', 'internal' => 'id'],
'hr_staff' => ['name' => 'account_status', 'type' => 'int', 'internal' => 'status'], 'hr_staff' => ['name' => 'hr_staff', 'type' => 'int', 'internal' => 'account'],
];
protected static $ownsOne = [
'account' => [
'mapper' => '\Modules\Admin\Models\AccountMapper',
'src' => 'hr_staff',
],
];
protected static $hasMany = [
'position' => [
'mapper' => '',
'table' => '',
'src' => '',
'dst' => '',
],
]; ];
/** /**
@ -46,12 +62,4 @@ class EmployeeMapper extends AccountMapper
* @since 1.0.0 * @since 1.0.0
*/ */
protected static $primaryField = 'hr_staff_id'; protected static $primaryField = 'hr_staff_id';
/**
* Overwriting extended
*
* @var bool
* @since 1.0.0
*/
protected static $overwrite = false;
} }