Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
CostCenterMapper | 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\Accounting\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\Accounting\Models; |
16 | |
17 | use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; |
18 | |
19 | /** |
20 | * Accounting mapper class. |
21 | * |
22 | * @package Modules\Accounting\Models |
23 | * @license OMS License 2.0 |
24 | * @link https://jingga.app |
25 | * @since 1.0.0 |
26 | * |
27 | * @template T of CostCenter |
28 | * @extends DataMapperFactory<T> |
29 | */ |
30 | final class CostCenterMapper 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 | 'accounting_costcenter_id' => ['name' => 'accounting_costcenter_id', 'type' => 'int', 'internal' => 'id'], |
40 | 'accounting_costcenter_code' => ['name' => 'accounting_costcenter_code', 'type' => 'string', 'internal' => 'code'], |
41 | ]; |
42 | |
43 | /** |
44 | * Has many relation. |
45 | * |
46 | * @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}> |
47 | * @since 1.0.0 |
48 | */ |
49 | public const HAS_MANY = [ |
50 | 'l11n' => [ |
51 | 'mapper' => CostCenterL11nMapper::class, |
52 | 'table' => 'accounting_costcenter_l11n', |
53 | 'self' => 'accounting_costcenter_l11n_costcenter', |
54 | 'conditional' => true, |
55 | 'external' => null, |
56 | ], |
57 | ]; |
58 | |
59 | /** |
60 | * Model to use by the mapper. |
61 | * |
62 | * @var class-string<T> |
63 | * @since 1.0.0 |
64 | */ |
65 | public const MODEL = CostCenter::class; |
66 | |
67 | /** |
68 | * Primary table. |
69 | * |
70 | * @var string |
71 | * @since 1.0.0 |
72 | */ |
73 | public const TABLE = 'accounting_costcenter'; |
74 | |
75 | /** |
76 | * Primary field name. |
77 | * |
78 | * @var string |
79 | * @since 1.0.0 |
80 | */ |
81 | public const PRIMARYFIELD = 'accounting_costcenter_id'; |
82 | } |