app model

This commit is contained in:
Dennis Eichhorn 2021-09-24 18:21:56 +02:00
parent bcf2372d3f
commit 7da35d00d5
2 changed files with 125 additions and 0 deletions

60
Models/App.php Normal file
View File

@ -0,0 +1,60 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\Admin\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\Admin\Models;
use phpOMS\Application\ApplicationStatus;
/**
* App model.
*
* @package Modules\Admin\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
class App
{
/**
* Id
*
* @var int
* @since 1.0.0
*/
protected int $id = 0;
/**
* Name
*
* @var string
* @since 1.0.0
*/
public string $name = '';
/**
* Theme
*
* @var string
* @since 1.0.0
*/
public string $theme = '';
/**
* Status
*
* @var int
* @since 1.0.0
*/
public int $status = ApplicationStatus::NORMAL;
}

65
Models/AppMapper.php Normal file
View File

@ -0,0 +1,65 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\Admin\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\Admin\Models;
use phpOMS\DataStorage\Database\DataMapperAbstract;
/**
* Account mapper class.
*
* @package Modules\Admin\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
final class AppMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array<string, array<string, bool|string|array>>
* @since 1.0.0
*/
protected static array $columns = [
'app_id' => ['name' => 'app_id', 'type' => 'int', 'internal' => 'id'],
'app_name' => ['name' => 'app_name', 'type' => 'string', 'internal' => 'name'],
'app_theme' => ['name' => 'app_theme', 'type' => 'string', 'internal' => 'theme'],
'app_status' => ['name' => 'app_status', 'type' => 'int', 'internal' => 'status'],
];
/**
* Model to use by the mapper.
*
* @var string
* @since 1.0.0
*/
protected static string $model = App::class;
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static string $table = 'app';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static string $primaryField = 'app_id';
}