oms-OnlineResourceWatcher/Models/ResourceMapper.php
2022-11-25 19:25:23 +01:00

70 lines
1.7 KiB
PHP

<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\OnlineResourceWatcher\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://karaka.app
*/
declare(strict_types=1);
namespace Modules\OnlineResourceWatcher\Models;
use Modules\Admin\Models\AccountMapper;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Resource mapper class.
*
* @package Modules\OnlineResourceWatcher\Models
* @license OMS License 1.0
* @link https://karaka.app
* @since 1.0.0
*/
final class ResourceMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'orw_resource_id' => ['name' => 'orw_resource_id', 'type' => 'int', 'internal' => 'id'],
'orw_resource_owner' => ['name' => 'orw_resource_owner', 'type' => 'int', 'internal' => 'owner', 'readonly' => true],
];
/**
* Belongs to.
*
* @var array<string, array{mapper:string, external:string, column?:string, by?:string}>
* @since 1.0.0
*/
public const BELONGS_TO = [
'owner' => [
'mapper' => AccountMapper::class,
'external' => 'orw_resource_owner',
],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'orw_resource';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD ='orw_resource_id';
}