Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
BillAttributeTypeMapper
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\Attribute
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\Attribute;
16
17use Modules\Attribute\Models\AttributeType;
18use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
19
20/**
21 * Bill mapper class.
22 *
23 * @package Modules\Billing\Models\Attribute
24 * @license OMS License 2.0
25 * @link    https://jingga.app
26 * @since   1.0.0
27 *
28 * @template T of AttributeType
29 * @extends DataMapperFactory<T>
30 */
31final class BillAttributeTypeMapper 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_attr_type_id'         => ['name' => 'billing_attr_type_id',       'type' => 'int',    'internal' => 'id'],
41        'billing_attr_type_name'       => ['name' => 'billing_attr_type_name',     'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
42        'billing_attr_type_datatype'   => ['name' => 'billing_attr_type_datatype',   'type' => 'int',    'internal' => 'datatype'],
43        'billing_attr_type_fields'     => ['name' => 'billing_attr_type_fields',   'type' => 'int',    'internal' => 'fields'],
44        'billing_attr_type_custom'     => ['name' => 'billing_attr_type_custom',   'type' => 'bool',   'internal' => 'custom'],
45        'billing_attr_type_pattern'    => ['name' => 'billing_attr_type_pattern',  'type' => 'string', 'internal' => 'validationPattern'],
46        'billing_attr_type_required'   => ['name' => 'billing_attr_type_required', 'type' => 'bool',   'internal' => 'isRequired'],
47    ];
48
49    /**
50     * Has many relation.
51     *
52     * @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
53     * @since 1.0.0
54     */
55    public const HAS_MANY = [
56        'l11n' => [
57            'mapper'   => BillAttributeTypeL11nMapper::class,
58            'table'    => 'billing_attr_type_l11n',
59            'self'     => 'billing_attr_type_l11n_type',
60            'column'   => 'content',
61            'external' => null,
62        ],
63        'defaults' => [
64            'mapper'   => BillAttributeValueMapper::class,
65            'table'    => 'billing_bill_attr_default',
66            'self'     => 'billing_bill_attr_default_type',
67            'external' => 'billing_bill_attr_default_value',
68        ],
69    ];
70
71    /**
72     * Model to use by the mapper.
73     *
74     * @var class-string<T>
75     * @since 1.0.0
76     */
77    public const MODEL = AttributeType::class;
78
79    /**
80     * Primary table.
81     *
82     * @var string
83     * @since 1.0.0
84     */
85    public const TABLE = 'billing_attr_type';
86
87    /**
88     * Primary field name.
89     *
90     * @var string
91     * @since 1.0.0
92     */
93    public const PRIMARYFIELD = 'billing_attr_type_id';
94}