oms-Accounting/Models/CostObjectMapper.php
2024-03-20 07:21:20 +00:00

84 lines
2.1 KiB
PHP
Executable File

<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package Modules\Accounting\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Accounting\Models;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Accounting mapper class.
*
* @package Modules\Accounting\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of CostObject
* @extends DataMapperFactory<T>
*/
final class CostObjectMapper 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 = [
'accounting_costobject_id' => ['name' => 'accounting_costobject_id', 'type' => 'int', 'internal' => 'id'],
'accounting_costobject_code' => ['name' => 'accounting_costobject_code', 'type' => 'string', 'internal' => 'code'],
'accounting_costobject_unit' => ['name' => 'accounting_costobject_unit', 'type' => 'int', 'internal' => 'unit'],
];
/**
* Has many relation.
*
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
* @since 1.0.0
*/
public const HAS_MANY = [
'l11n' => [
'mapper' => CostObjectL11nMapper::class,
'table' => 'accounting_costobject_l11n',
'self' => 'accounting_costobject_l11n_costobject',
'column' => 'content',
'external' => null,
],
];
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = CostObject::class;
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'accounting_costobject';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'accounting_costobject_id';
}