Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| BillElementMapper | 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 phpOMS\DataStorage\Database\Mapper\DataMapperFactory; |
| 18 | |
| 19 | /** |
| 20 | * Mapper class. |
| 21 | * |
| 22 | * @package Modules\Billing\Models |
| 23 | * @license OMS License 2.0 |
| 24 | * @link https://jingga.app |
| 25 | * @since 1.0.0 |
| 26 | * |
| 27 | * @template T of BillElement |
| 28 | * @extends DataMapperFactory<T> |
| 29 | */ |
| 30 | final class BillElementMapper 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 | 'billing_bill_element_id' => ['name' => 'billing_bill_element_id', 'type' => 'int', 'internal' => 'id'], |
| 40 | 'billing_bill_element_order' => ['name' => 'billing_bill_element_order', 'type' => 'int', 'internal' => 'order'], |
| 41 | 'billing_bill_element_item' => ['name' => 'billing_bill_element_item', 'type' => 'int', 'internal' => 'item'], |
| 42 | 'billing_bill_element_item_number' => ['name' => 'billing_bill_element_item_number', 'type' => 'string', 'internal' => 'itemNumber'], |
| 43 | 'billing_bill_element_item_name' => ['name' => 'billing_bill_element_item_name', 'type' => 'string', 'internal' => 'itemName'], |
| 44 | 'billing_bill_element_item_desc' => ['name' => 'billing_bill_element_item_desc', 'type' => 'string', 'internal' => 'itemDescription'], |
| 45 | 'billing_bill_element_quantity' => ['name' => 'billing_bill_element_quantity', 'type' => 'int', 'internal' => 'quantity', 'private' => true], |
| 46 | |
| 47 | 'billing_bill_element_single_netlistprice' => ['name' => 'billing_bill_element_single_netlistprice', 'type' => 'Serializable', 'internal' => 'singleListPriceNet'], |
| 48 | 'billing_bill_element_single_grosslistprice' => ['name' => 'billing_bill_element_single_grosslistprice', 'type' => 'Serializable', 'internal' => 'singleListPriceGross'], |
| 49 | 'billing_bill_element_total_netlistprice' => ['name' => 'billing_bill_element_total_netlistprice', 'type' => 'Serializable', 'internal' => 'totalListPriceNet'], |
| 50 | 'billing_bill_element_total_grosslistprice' => ['name' => 'billing_bill_element_total_grosslistprice', 'type' => 'Serializable', 'internal' => 'totalListPriceGross'], |
| 51 | |
| 52 | 'billing_bill_element_single_netsalesprice' => ['name' => 'billing_bill_element_single_netsalesprice', 'type' => 'Serializable', 'internal' => 'singleSalesPriceNet'], |
| 53 | 'billing_bill_element_single_grosssalesprice' => ['name' => 'billing_bill_element_single_grosssalesprice', 'type' => 'Serializable', 'internal' => 'singleSalesPriceGross'], |
| 54 | 'billing_bill_element_total_netsalesprice' => ['name' => 'billing_bill_element_total_netsalesprice', 'type' => 'Serializable', 'internal' => 'totalSalesPriceNet'], |
| 55 | 'billing_bill_element_total_grosssalesprice' => ['name' => 'billing_bill_element_total_grosssalesprice', 'type' => 'Serializable', 'internal' => 'totalSalesPriceGross'], |
| 56 | |
| 57 | 'billing_bill_element_single_netprofit' => ['name' => 'billing_bill_element_single_netprofit', 'type' => 'Serializable', 'internal' => 'singleProfitNet'], |
| 58 | 'billing_bill_element_single_grossprofit' => ['name' => 'billing_bill_element_single_grossprofit', 'type' => 'Serializable', 'internal' => 'singleProfitGross'], |
| 59 | 'billing_bill_element_total_netprofit' => ['name' => 'billing_bill_element_total_netprofit', 'type' => 'Serializable', 'internal' => 'totalProfitNet'], |
| 60 | 'billing_bill_element_total_grossprofit' => ['name' => 'billing_bill_element_total_grossprofit', 'type' => 'Serializable', 'internal' => 'totalProfitGross'], |
| 61 | |
| 62 | 'billing_bill_element_single_netpurchaseprice' => ['name' => 'billing_bill_element_single_netpurchaseprice', 'type' => 'Serializable', 'internal' => 'singlePurchasePriceNet'], |
| 63 | 'billing_bill_element_single_grosspurchaseprice' => ['name' => 'billing_bill_element_single_grosspurchaseprice', 'type' => 'Serializable', 'internal' => 'singlePurchasePriceGross'], |
| 64 | 'billing_bill_element_total_netpurchaseprice' => ['name' => 'billing_bill_element_total_netpurchaseprice', 'type' => 'Serializable', 'internal' => 'totalPurchasePriceNet'], |
| 65 | 'billing_bill_element_total_grosspurchaseprice' => ['name' => 'billing_bill_element_total_grosspurchaseprice', 'type' => 'Serializable', 'internal' => 'totalPurchasePriceGross'], |
| 66 | 'billing_bill_element_bill' => ['name' => 'billing_bill_element_bill', 'type' => 'int', 'internal' => 'bill'], |
| 67 | |
| 68 | 'billing_bill_element_tax_type' => ['name' => 'billing_bill_element_tax_type', 'type' => 'string', 'internal' => 'taxCode'], |
| 69 | 'billing_bill_element_tax_price' => ['name' => 'billing_bill_element_tax_price', 'type' => 'Serializable', 'internal' => 'taxP'], |
| 70 | 'billing_bill_element_tax_percentage' => ['name' => 'billing_bill_element_tax_percentage', 'type' => 'Serializable', 'internal' => 'taxR'], |
| 71 | ]; |
| 72 | |
| 73 | /** |
| 74 | * Belongs to. |
| 75 | * |
| 76 | * @var array<string, array{mapper:class-string, external:string, column?:string, by?:string}> |
| 77 | * @since 1.0.0 |
| 78 | */ |
| 79 | public const BELONGS_TO = [ |
| 80 | 'bill' => [ |
| 81 | 'mapper' => BillMapper::class, |
| 82 | 'external' => 'billing_bill_element_bill', |
| 83 | ], |
| 84 | ]; |
| 85 | |
| 86 | /** |
| 87 | * Has one relation. |
| 88 | * |
| 89 | * @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}> |
| 90 | * @since 1.0.0 |
| 91 | */ |
| 92 | public const OWNS_ONE = [ |
| 93 | 'subscription' => [ |
| 94 | 'mapper' => SubscriptionMapper::class, |
| 95 | 'external' => 'billing_bill_element_subscription', |
| 96 | ], |
| 97 | ]; |
| 98 | |
| 99 | /** |
| 100 | * Primary field name. |
| 101 | * |
| 102 | * @var string |
| 103 | * @since 1.0.0 |
| 104 | */ |
| 105 | public const PRIMARYFIELD = 'billing_bill_element_id'; |
| 106 | |
| 107 | /** |
| 108 | * Primary table. |
| 109 | * |
| 110 | * @var string |
| 111 | * @since 1.0.0 |
| 112 | */ |
| 113 | public const TABLE = 'billing_bill_element'; |
| 114 | } |