Code Coverage  | 
      ||||||||||
Lines  | 
       Functions and Methods  | 
       Classes and Traits  | 
      ||||||||
| Total | n/a  | 
       0 / 0  | 
       n/a  | 
       0 / 0  | 
       CRAP | n/a  | 
       0 / 0  | 
      |||
| AddressMapper | 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\Admin\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\Admin\Models; | 
| 16 | |
| 17 | use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; | 
| 18 | use phpOMS\Localization\Defaults\CountryMapper; | 
| 19 | |
| 20 | /** | 
| 21 | * Address mapper class. | 
| 22 | * | 
| 23 | * @package Modules\Admin\Models | 
| 24 | * @license OMS License 2.0 | 
| 25 | * @link https://jingga.app | 
| 26 | * @since 1.0.0 | 
| 27 | * | 
| 28 | * @template T of Address | 
| 29 | * @extends DataMapperFactory<T> | 
| 30 | */ | 
| 31 | final class AddressMapper 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 | 'address_id' => ['name' => 'address_id', 'type' => 'int', 'internal' => 'id'], | 
| 41 | 'address_name' => ['name' => 'address_name', 'type' => 'string', 'internal' => 'name'], | 
| 42 | 'address_addition' => ['name' => 'address_addition', 'type' => 'string', 'internal' => 'addition'], | 
| 43 | 'address_address' => ['name' => 'address_address', 'type' => 'string', 'internal' => 'address'], | 
| 44 | 'address_postal' => ['name' => 'address_postal', 'type' => 'string', 'internal' => 'postal'], | 
| 45 | 'address_state' => ['name' => 'address_state', 'type' => 'string', 'internal' => 'state'], | 
| 46 | 'address_city' => ['name' => 'address_city', 'type' => 'string', 'internal' => 'city'], | 
| 47 | 'address_country' => ['name' => 'address_country', 'type' => 'string', 'internal' => 'country'], | 
| 48 | 'address_type' => ['name' => 'address_type', 'type' => 'int', 'internal' => 'type'], | 
| 49 | 'address_lat' => ['name' => 'address_lat', 'type' => 'float', 'internal' => 'lat'], | 
| 50 | 'address_lon' => ['name' => 'address_lon', 'type' => 'float', 'internal' => 'lon'], | 
| 51 | ]; | 
| 52 | |
| 53 | /** | 
| 54 | * Has one relation. | 
| 55 | * | 
| 56 | * @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}> | 
| 57 | * @since 1.0.0 | 
| 58 | */ | 
| 59 | public const OWNS_ONE = [ | 
| 60 | 'country' => [ | 
| 61 | 'mapper' => CountryMapper::class, | 
| 62 | 'external' => 'address_country', | 
| 63 | 'by' => 'code2', | 
| 64 | 'column' => 'code2', | 
| 65 | 'conditional' => true, | 
| 66 | ], | 
| 67 | ]; | 
| 68 | |
| 69 | /** | 
| 70 | * Primary table. | 
| 71 | * | 
| 72 | * @var string | 
| 73 | * @since 1.0.0 | 
| 74 | */ | 
| 75 | public const TABLE = 'address'; | 
| 76 | |
| 77 | /** | 
| 78 | * Primary field name. | 
| 79 | * | 
| 80 | * @var string | 
| 81 | * @since 1.0.0 | 
| 82 | */ | 
| 83 | public const PRIMARYFIELD = 'address_id'; | 
| 84 | } |