mirror of
https://github.com/Karaka-Management/oms-Organization.git
synced 2026-01-11 16:18:40 +00:00
86 lines
2.7 KiB
PHP
Executable File
86 lines
2.7 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Orange Management
|
|
*
|
|
* PHP Version 8.0
|
|
*
|
|
* @package Modules\Organization\Models
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link https://orange-management.org
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Organization\Models;
|
|
|
|
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
|
|
|
/**
|
|
* Organization department mapper class.
|
|
*
|
|
* @package Modules\Organization\Models
|
|
* @license OMS License 1.0
|
|
* @link https://orange-management.org
|
|
* @since 1.0.0
|
|
*/
|
|
final class DepartmentMapper extends DataMapperFactory
|
|
{
|
|
/**
|
|
* Columns.
|
|
*
|
|
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
|
* @since 1.0.0
|
|
*/
|
|
public const COLUMNS = [
|
|
'organization_department_id' => ['name' => 'organization_department_id', 'type' => 'int', 'internal' => 'id'],
|
|
'organization_department_name' => ['name' => 'organization_department_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
|
|
'organization_department_description' => ['name' => 'organization_department_description', 'type' => 'string', 'internal' => 'description'],
|
|
'organization_department_descriptionraw' => ['name' => 'organization_department_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
|
|
'organization_department_parent' => ['name' => 'organization_department_parent', 'type' => 'int', 'internal' => 'parent'],
|
|
'organization_department_status' => ['name' => 'organization_department_status', 'type' => 'int', 'internal' => 'status'],
|
|
'organization_department_unit' => ['name' => 'organization_department_unit', 'type' => 'int', 'internal' => 'unit'],
|
|
];
|
|
|
|
/**
|
|
* Belongs to.
|
|
*
|
|
* @var array<string, array{mapper:string, external:string}>
|
|
* @since 1.0.0
|
|
*/
|
|
public const BELONGS_TO = [
|
|
'unit' => [
|
|
'mapper' => UnitMapper::class,
|
|
'external' => 'organization_department_unit',
|
|
],
|
|
'parent' => [
|
|
'mapper' => self::class,
|
|
'external' => 'organization_department_parent',
|
|
],
|
|
];
|
|
|
|
/**
|
|
* Model to use by the mapper.
|
|
*
|
|
* @var string
|
|
* @since 1.0.0
|
|
*/
|
|
public const MODEL = Department::class;
|
|
|
|
/**
|
|
* Primary table.
|
|
*
|
|
* @var string
|
|
* @since 1.0.0
|
|
*/
|
|
public const TABLE = 'organization_department';
|
|
|
|
/**
|
|
* Primary field name.
|
|
*
|
|
* @var string
|
|
* @since 1.0.0
|
|
*/
|
|
public const PRIMARYFIELD ='organization_department_id';
|
|
}
|