Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| BillTypeMapper | 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\Billing\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\Billing\Models; |
| 16 | |
| 17 | use Modules\Media\Models\CollectionMapper; |
| 18 | use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; |
| 19 | |
| 20 | /** |
| 21 | * Billing mapper class. |
| 22 | * |
| 23 | * @package Modules\Billing\Models |
| 24 | * @license OMS License 2.0 |
| 25 | * @link https://jingga.app |
| 26 | * @since 1.0.0 |
| 27 | * |
| 28 | * @template T of BillType |
| 29 | * @extends DataMapperFactory<T> |
| 30 | */ |
| 31 | final class BillTypeMapper extends DataMapperFactory |
| 32 | { |
| 33 | /** |
| 34 | * Columns. |
| 35 | * |
| 36 | * @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}> |
| 37 | * @since 1.0.0 |
| 38 | */ |
| 39 | public const COLUMNS = [ |
| 40 | 'billing_type_id' => ['name' => 'billing_type_id', 'type' => 'int', 'internal' => 'id'], |
| 41 | 'billing_type_name' => ['name' => 'billing_type_name', 'type' => 'string', 'internal' => 'name'], |
| 42 | 'billing_type_number_format' => ['name' => 'billing_type_number_format', 'type' => 'string', 'internal' => 'numberFormat'], |
| 43 | 'billing_type_account_format' => ['name' => 'billing_type_account_format', 'type' => 'string', 'internal' => 'accountFormat'], |
| 44 | 'billing_type_transfer_type' => ['name' => 'billing_type_transfer_type', 'type' => 'int', 'internal' => 'transferType'], |
| 45 | 'billing_type_default_template' => ['name' => 'billing_type_default_template', 'type' => 'int', 'internal' => 'defaultTemplate'], |
| 46 | 'billing_type_transfer_stock' => ['name' => 'billing_type_transfer_stock', 'type' => 'bool', 'internal' => 'transferStock'], |
| 47 | 'billing_type_transfer_sign' => ['name' => 'billing_type_transfer_sign', 'type' => 'int', 'internal' => 'sign'], |
| 48 | 'billing_type_is_template' => ['name' => 'billing_type_is_template', 'type' => 'bool', 'internal' => 'isTemplate'], |
| 49 | ]; |
| 50 | |
| 51 | /** |
| 52 | * Has many relation. |
| 53 | * |
| 54 | * @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}> |
| 55 | * @since 1.0.0 |
| 56 | */ |
| 57 | public const HAS_MANY = [ |
| 58 | 'l11n' => [ |
| 59 | 'mapper' => BillTypeL11nMapper::class, |
| 60 | 'table' => 'billing_type_l11n', |
| 61 | 'self' => 'billing_type_l11n_type', |
| 62 | 'column' => 'content', |
| 63 | 'external' => null, |
| 64 | ], |
| 65 | 'templates' => [ |
| 66 | 'mapper' => CollectionMapper::class, |
| 67 | 'table' => 'billing_bill_type_media_rel', |
| 68 | 'external' => 'billing_bill_type_media_rel_dst', |
| 69 | 'self' => 'billing_bill_type_media_rel_src', |
| 70 | ], |
| 71 | ]; |
| 72 | |
| 73 | /** |
| 74 | * Has one relation. |
| 75 | * |
| 76 | * @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}> |
| 77 | * @since 1.0.0 |
| 78 | */ |
| 79 | public const OWNS_ONE = [ |
| 80 | 'defaultTemplate' => [ |
| 81 | 'mapper' => CollectionMapper::class, |
| 82 | 'external' => 'billing_type_default_template', |
| 83 | ], |
| 84 | ]; |
| 85 | |
| 86 | /** |
| 87 | * Belongs to. |
| 88 | * |
| 89 | * @var array<string, array{mapper:class-string, self:string}> |
| 90 | * @since 1.0.0 |
| 91 | */ |
| 92 | /* |
| 93 | public const BELONGS_TO = [ |
| 94 | 'owner' => [ |
| 95 | 'mapper' => AccountMapper::class, |
| 96 | 'external' => 'billing_type_owner', |
| 97 | ], |
| 98 | ]; |
| 99 | */ |
| 100 | |
| 101 | /** |
| 102 | * Model to use by the mapper. |
| 103 | * |
| 104 | * @var class-string<T> |
| 105 | * @since 1.0.0 |
| 106 | */ |
| 107 | public const MODEL = BillType::class; |
| 108 | |
| 109 | /** |
| 110 | * Primary table. |
| 111 | * |
| 112 | * @var string |
| 113 | * @since 1.0.0 |
| 114 | */ |
| 115 | public const TABLE = 'billing_type'; |
| 116 | |
| 117 | /** |
| 118 | * Primary field name. |
| 119 | * |
| 120 | * @var string |
| 121 | * @since 1.0.0 |
| 122 | */ |
| 123 | public const PRIMARYFIELD = 'billing_type_id'; |
| 124 | } |