mirror of
https://github.com/Karaka-Management/oms-Checklist.git
synced 2026-01-11 15:28:41 +00:00
77 lines
2.0 KiB
PHP
77 lines
2.0 KiB
PHP
<?php
|
|
/**
|
|
* Jingga
|
|
*
|
|
* PHP Version 8.2
|
|
*
|
|
* @package Modules\Checklist\Models
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 2.0
|
|
* @version 1.0.0
|
|
* @link https://jingga.app
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Checklist\Models;
|
|
|
|
use Modules\Tasks\Models\TaskMapper;
|
|
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
|
|
|
/**
|
|
* Checklist mapper class.
|
|
*
|
|
* @package Modules\Checklist\Models
|
|
* @license OMS License 2.0
|
|
* @link https://jingga.app
|
|
* @since 1.0.0
|
|
*
|
|
* @template T of Checklist
|
|
* @extends DataMapperFactory<T>
|
|
*/
|
|
final class ChecklistMapper 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 = [
|
|
'checklist_id' => ['name' => 'checklist_id', 'type' => 'int', 'internal' => 'id'],
|
|
'checklist_name' => ['name' => 'checklist_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
|
|
'checklist_template' => ['name' => 'checklist_template', 'type' => 'int', 'internal' => 'template'],
|
|
'checklist_createdat' => ['name' => 'checklist_createdat', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
|
|
];
|
|
|
|
/**
|
|
* 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 = [
|
|
'tasks' => [
|
|
'mapper' => TaskMapper::class,
|
|
'table' => 'checklist_task',
|
|
'self' => 'checklist_task_checklist',
|
|
'external' => 'checklist_task_task',
|
|
],
|
|
];
|
|
|
|
/**
|
|
* Primary table.
|
|
*
|
|
* @var string
|
|
* @since 1.0.0
|
|
*/
|
|
public const TABLE = 'checklist';
|
|
|
|
/**
|
|
* Primary field name.
|
|
*
|
|
* @var string
|
|
* @since 1.0.0
|
|
*/
|
|
public const PRIMARYFIELD = 'checklist_id';
|
|
}
|