Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| AccountAbstractMapper | 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 | * Account 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 AccountAbstract |
| 28 | * @extends DataMapperFactory<T> |
| 29 | */ |
| 30 | class AccountAbstractMapper 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_account_id' => ['name' => 'accounting_account_id', 'type' => 'int', 'internal' => 'id'], |
| 40 | 'accounting_account_account' => ['name' => 'accounting_account_account', 'type' => 'string', 'internal' => 'account', 'autocomplete' => true], |
| 41 | 'accounting_account_type' => ['name' => 'accounting_account_type', 'type' => 'int', 'internal' => 'type'], |
| 42 | 'accounting_account_parent' => ['name' => 'accounting_account_parent', 'type' => 'int', 'internal' => 'parent'], |
| 43 | ]; |
| 44 | |
| 45 | /** |
| 46 | * Has many relation. |
| 47 | * |
| 48 | * @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}> |
| 49 | * @since 1.0.0 |
| 50 | */ |
| 51 | public const HAS_MANY = [ |
| 52 | 'l11n' => [ |
| 53 | 'mapper' => AccountL11nMapper::class, |
| 54 | 'table' => 'accounting_account_l11n', |
| 55 | 'self' => 'accounting_account_l11n_account', |
| 56 | 'column' => 'content', |
| 57 | 'external' => null, |
| 58 | ], |
| 59 | ]; |
| 60 | |
| 61 | /** |
| 62 | * Model to use by the mapper. |
| 63 | * |
| 64 | * @var class-string<T> |
| 65 | * @since 1.0.0 |
| 66 | */ |
| 67 | public const MODEL = AccountAbstract::class; |
| 68 | |
| 69 | /** |
| 70 | * Primary table. |
| 71 | * |
| 72 | * @var string |
| 73 | * @since 1.0.0 |
| 74 | */ |
| 75 | public const TABLE = 'accounting_account'; |
| 76 | |
| 77 | /** |
| 78 | * Primary field name. |
| 79 | * |
| 80 | * @var string |
| 81 | * @since 1.0.0 |
| 82 | */ |
| 83 | public const PRIMARYFIELD = 'accounting_account_id'; |
| 84 | } |