Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
TaskAttributeTypeMapper | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
1 | <?php |
2 | /** |
3 | * Jingga |
4 | * |
5 | * PHP Version 8.1 |
6 | * |
7 | * @package Modules\Tasks\Models |
8 | * @copyright Dennis Eichhorn |
9 | * @license OMS License 2.0 |
10 | * @version 1.0.0 |
11 | * @link https://jingga.app |
12 | */ |
13 | declare(strict_types=1); |
14 | |
15 | namespace Modules\Tasks\Models; |
16 | |
17 | use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; |
18 | |
19 | /** |
20 | * Task mapper class. |
21 | * |
22 | * @package Modules\Tasks\Models |
23 | * @license OMS License 2.0 |
24 | * @link https://jingga.app |
25 | * @since 1.0.0 |
26 | * |
27 | * @template T of TaskAttributeType |
28 | * @extends DataMapperFactory<T> |
29 | */ |
30 | final class TaskAttributeTypeMapper extends DataMapperFactory |
31 | { |
32 | /** |
33 | * Columns. |
34 | * |
35 | * @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}> |
36 | * @since 1.0.0 |
37 | */ |
38 | public const COLUMNS = [ |
39 | 'task_attr_type_id' => ['name' => 'task_attr_type_id', 'type' => 'int', 'internal' => 'id'], |
40 | 'task_attr_type_name' => ['name' => 'task_attr_type_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true], |
41 | 'task_attr_type_fields' => ['name' => 'task_attr_type_fields', 'type' => 'int', 'internal' => 'fields'], |
42 | 'task_attr_type_custom' => ['name' => 'task_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'], |
43 | 'task_attr_type_pattern' => ['name' => 'task_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'], |
44 | 'task_attr_type_required' => ['name' => 'task_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'], |
45 | ]; |
46 | |
47 | /** |
48 | * Has many relation. |
49 | * |
50 | * @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}> |
51 | * @since 1.0.0 |
52 | */ |
53 | public const HAS_MANY = [ |
54 | 'l11n' => [ |
55 | 'mapper' => TaskAttributeTypeL11nMapper::class, |
56 | 'table' => 'task_attr_type_l11n', |
57 | 'self' => 'task_attr_type_l11n_type', |
58 | 'column' => 'content', |
59 | 'external' => null, |
60 | ], |
61 | 'defaults' => [ |
62 | 'mapper' => TaskAttributeValueMapper::class, |
63 | 'table' => 'task_attr_default', |
64 | 'self' => 'task_attr_default_type', |
65 | 'external' => 'task_attr_default_value', |
66 | ], |
67 | ]; |
68 | |
69 | /** |
70 | * Primary table. |
71 | * |
72 | * @var string |
73 | * @since 1.0.0 |
74 | */ |
75 | public const TABLE = 'task_attr_type'; |
76 | |
77 | /** |
78 | * Primary field name. |
79 | * |
80 | * @var string |
81 | * @since 1.0.0 |
82 | */ |
83 | public const PRIMARYFIELD = 'task_attr_type_id'; |
84 | } |