oms-HumanResourceManagement/Models/EmployeeMapper.php

78 lines
1.7 KiB
PHP

<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\HumanResourceManagement\Models;
use Modules\Admin\Models\AccountMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract;
final class EmployeeMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array<string, array<string, bool|string>>
* @since 1.0.0
*/
protected static array $columns = [
'hr_staff_id' => ['name' => 'hr_staff_id', 'type' => 'int', 'internal' => 'id'],
'hr_staff_account' => ['name' => 'hr_staff_account', 'type' => 'int', 'internal' => 'account'],
];
/**
* Belongs to.
*
* @var array<string, array<string, string>>
* @since 1.0.0
*/
protected static array $belongsTo = [
'account' => [
'mapper' => AccountMapper::class,
'src' => 'hr_staff_account',
],
];
/**
* Has many relation.
*
* @var array<string, array<string, null|string>>
* @since 1.0.0
*/
protected static array $hasMany = [
'history' => [
'mapper' => EmployeeHistoryMapper::class,
'table' => 'hr_staff_history',
'dst' => 'hr_staff_history_staff',
'src' => null,
],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static string $table = 'hr_staff';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static string $primaryField = 'hr_staff_id';
}