Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
TaxCombinationMapper
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\Tax
8 * @copyright Dennis Eichhorn
9 * @license   OMS License 2.0
10 * @version   1.0.0
11 * @link      https://jingga.app
12 */
13declare(strict_types=1);
14
15namespace Modules\Billing\Models\Tax;
16
17use Modules\ClientManagement\Models\Attribute\ClientAttributeValueMapper;
18use Modules\ItemManagement\Models\Attribute\ItemAttributeValueMapper;
19use Modules\SupplierManagement\Models\SupplierAttributeValueMapper;
20use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
21
22/**
23 * Billing mapper class.
24 *
25 * @package Modules\Billing\Models\Tax
26 * @license OMS License 2.0
27 * @link    https://jingga.app
28 * @since   1.0.0
29 *
30 * @template T of TaxCombination
31 * @extends DataMapperFactory<T>
32 */
33final class TaxCombinationMapper extends DataMapperFactory
34{
35    /**
36     * Columns.
37     *
38     * @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
39     * @since 1.0.0
40     */
41    public const COLUMNS = [
42        'billing_tax_id'               => ['name' => 'billing_tax_id',                          'type' => 'int',    'internal' => 'id'],
43        'billing_tax_client_code'      => ['name' => 'billing_tax_client_code',           'type' => 'int', 'internal' => 'clientCode'],
44        'billing_tax_supplier_code'    => ['name' => 'billing_tax_supplier_code',       'type' => 'int', 'internal' => 'supplierCode'],
45        'billing_tax_item_code'        => ['name' => 'billing_tax_item_code',               'type' => 'int', 'internal' => 'itemCode'],
46        'billing_tax_code'             => ['name' => 'billing_tax_code',                         'type' => 'string', 'internal' => 'taxCode'],
47        'billing_tax_type'             => ['name' => 'billing_tax_type',                         'type' => 'int', 'internal' => 'taxType'],
48        'billing_tax_account'          => ['name' => 'billing_tax_account',                   'type' => 'string', 'internal' => 'account'],
49        'billing_tax_refund_account'   => ['name' => 'billing_tax_refund_account',     'type' => 'string', 'internal' => 'refundAccount'],
50        'billing_tax_discount_account' => ['name' => 'billing_tax_discount_account', 'type' => 'string', 'internal' => 'discountAccount'],
51        'billing_tax_min_price'        => ['name' => 'billing_tax_min_price',               'type' => 'int', 'internal' => 'minPrice'],
52        'billing_tax_max_price'        => ['name' => 'billing_tax_max_price',               'type' => 'int', 'internal' => 'maxPrice'],
53        'billing_tax_start'            => ['name' => 'billing_tax_start',                       'type' => 'DateTime', 'internal' => 'start'],
54        'billing_tax_end'              => ['name' => 'billing_tax_end',                           'type' => 'DateTime', 'internal' => 'end'],
55    ];
56
57    /**
58     * Has one relation.
59     *
60     * @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
61     * @since 1.0.0
62     */
63    public const OWNS_ONE = [
64        'clientCode' => [
65            'mapper'   => ClientAttributeValueMapper::class,
66            'external' => 'billing_tax_client_code',
67        ],
68        'supplierCode' => [
69            'mapper'   => SupplierAttributeValueMapper::class,
70            'external' => 'billing_tax_supplier_code',
71        ],
72        'itemCode' => [
73            'mapper'   => ItemAttributeValueMapper::class,
74            'external' => 'billing_tax_item_code',
75        ],
76    ];
77
78    /**
79     * Model to use by the mapper.
80     *
81     * @var class-string<T>
82     * @since 1.0.0
83     */
84    public const MODEL = TaxCombination::class;
85
86    /**
87     * Primary table.
88     *
89     * @var string
90     * @since 1.0.0
91     */
92    public const TABLE = 'billing_tax';
93
94    /**
95     * Primary field name.
96     *
97     * @var string
98     * @since 1.0.0
99     */
100    public const PRIMARYFIELD = 'billing_tax_id';
101}