mirror of
https://github.com/Karaka-Management/oms-Exchange.git
synced 2026-02-15 17:28:41 +00:00
implement immutable datetime
This commit is contained in:
parent
494e7faae6
commit
37640e8edf
|
|
@ -40,5 +40,45 @@
|
||||||
"null": false
|
"null": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"exchange_log": {
|
||||||
|
"name": "exchange_log",
|
||||||
|
"fields": {
|
||||||
|
"exchange_log_id": {
|
||||||
|
"name": "exchange_log_id",
|
||||||
|
"type": "INT",
|
||||||
|
"null": false,
|
||||||
|
"primary": true,
|
||||||
|
"autoincrement": true
|
||||||
|
},
|
||||||
|
"exchange_log_message": {
|
||||||
|
"name": "exchange_log_message",
|
||||||
|
"type": "TEXT",
|
||||||
|
"null": false
|
||||||
|
},
|
||||||
|
"exchange_log_fields": {
|
||||||
|
"name": "exchange_log_fields",
|
||||||
|
"type": "TEXT",
|
||||||
|
"null": false
|
||||||
|
},
|
||||||
|
"exchange_log_type": {
|
||||||
|
"name": "exchange_log_type",
|
||||||
|
"type": "TINYINT",
|
||||||
|
"null": false
|
||||||
|
},
|
||||||
|
"exchange_log_time": {
|
||||||
|
"name": "exchange_log_time",
|
||||||
|
"type": "DATETIME",
|
||||||
|
"null": false
|
||||||
|
},
|
||||||
|
"exchange_log_exchange": {
|
||||||
|
"name": "exchange_log_exchange",
|
||||||
|
"type": "INT",
|
||||||
|
"default": null,
|
||||||
|
"null": true,
|
||||||
|
"foreignTable": "exchange",
|
||||||
|
"foreignKey": "exchange_id"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
47
Interfaces/GSD/Model/ExchangeType.php
Executable file
47
Interfaces/GSD/Model/ExchangeType.php
Executable file
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.4
|
||||||
|
*
|
||||||
|
* @package Modules\Exchange\Models
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://orange-management.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Modules\Exchange\Interfaces\GSD\Model;
|
||||||
|
|
||||||
|
use phpOMS\Stdlib\Base\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exchange status enum.
|
||||||
|
*
|
||||||
|
* @package Modules\Exchange\Models
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link https://orange-management.org
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
abstract class ExchangeType extends Enum
|
||||||
|
{
|
||||||
|
public const CUSTOMER = 1;
|
||||||
|
|
||||||
|
public const SUPPLIER = 2;
|
||||||
|
|
||||||
|
public const ARTICLE = 3;
|
||||||
|
|
||||||
|
public const BOOKING = 4;
|
||||||
|
|
||||||
|
public const ACCOUNT = 5;
|
||||||
|
|
||||||
|
public const ADDRESS = 6;
|
||||||
|
|
||||||
|
public const COSTCENTER = 7;
|
||||||
|
|
||||||
|
public const COSTOBJECT = 8;
|
||||||
|
|
||||||
|
public const INVOICE = 9;
|
||||||
|
}
|
||||||
|
|
@ -34,7 +34,7 @@ final class GSDAddressMapper extends DataMapperAbstract
|
||||||
*/
|
*/
|
||||||
protected static array $columns = [
|
protected static array $columns = [
|
||||||
'AdressRowId' => ['name' => 'AdressRowId', 'type' => 'int', 'internal' => 'id'],
|
'AdressRowId' => ['name' => 'AdressRowId', 'type' => 'int', 'internal' => 'id'],
|
||||||
'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||||
'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||||
'NAME1' => ['name' => 'NAME1', 'type' => 'string', 'internal' => 'name1'],
|
'NAME1' => ['name' => 'NAME1', 'type' => 'string', 'internal' => 'name1'],
|
||||||
'NAME2' => ['name' => 'NAME2', 'type' => 'string', 'internal' => 'name2'],
|
'NAME2' => ['name' => 'NAME2', 'type' => 'string', 'internal' => 'name2'],
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ final class GSDArticle
|
||||||
* @var \DateTime
|
* @var \DateTime
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private \DateTime $createdAt;
|
private \DateTimeImmutable $createdAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Article number.
|
* Article number.
|
||||||
|
|
@ -135,7 +135,7 @@ final class GSDArticle
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->createdAt = new \DateTime('now');
|
$this->createdAt = new \DateTimeImmutable('now');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ final class GSDArticleMapper extends DataMapperAbstract
|
||||||
*/
|
*/
|
||||||
protected static array $columns = [
|
protected static array $columns = [
|
||||||
'row_id' => ['name' => 'row_id', 'type' => 'int', 'internal' => 'id'],
|
'row_id' => ['name' => 'row_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||||
'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||||
'Artikelnummer' => ['name' => 'Artikelnummer', 'type' => 'string', 'internal' => 'number'],
|
'Artikelnummer' => ['name' => 'Artikelnummer', 'type' => 'string', 'internal' => 'number'],
|
||||||
'Info' => ['name' => 'Info', 'type' => 'string', 'internal' => 'info'],
|
'Info' => ['name' => 'Info', 'type' => 'string', 'internal' => 'info'],
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ final class GSDCostCenter implements \JsonSerializable
|
||||||
* @var \DateTime
|
* @var \DateTime
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected \DateTime $createdAt;
|
protected \DateTimeImmutable $createdAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description.
|
* Description.
|
||||||
|
|
@ -71,7 +71,7 @@ final class GSDCostCenter implements \JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->createdAt = new \DateTime('now');
|
$this->createdAt = new \DateTimeImmutable('now');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -79,7 +79,7 @@ final class GSDCostCenter implements \JsonSerializable
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getCreatedAt() : \DateTime
|
public function getCreatedAt() : \DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->createdAt ?? new \DateTime();
|
return $this->createdAt ?? new \DateTime();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ final class GSDCostCenterMapper extends DataMapperAbstract
|
||||||
*/
|
*/
|
||||||
protected static array $columns = [
|
protected static array $columns = [
|
||||||
'ROW_ID' => ['name' => 'ROW_ID', 'type' => 'int', 'internal' => 'id'],
|
'ROW_ID' => ['name' => 'ROW_ID', 'type' => 'int', 'internal' => 'id'],
|
||||||
'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||||
'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||||
'KST' => ['name' => 'KST', 'type' => 'string', 'internal' => 'costcenter'],
|
'KST' => ['name' => 'KST', 'type' => 'string', 'internal' => 'costcenter'],
|
||||||
'Bezeichnung' => ['name' => 'Bezeichnung', 'type' => 'string', 'internal' => 'description'],
|
'Bezeichnung' => ['name' => 'Bezeichnung', 'type' => 'string', 'internal' => 'description'],
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ final class GSDCostObject implements \JsonSerializable
|
||||||
* @var \DateTime
|
* @var \DateTime
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected \DateTime $createdAt;
|
protected \DateTimeImmutable $createdAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description.
|
* Description.
|
||||||
|
|
@ -71,7 +71,7 @@ final class GSDCostObject implements \JsonSerializable
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->createdAt = new \DateTime('now');
|
$this->createdAt = new \DateTimeImmutable('now');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -79,7 +79,7 @@ final class GSDCostObject implements \JsonSerializable
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function getCreatedAt() : \DateTime
|
public function getCreatedAt() : \DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->createdAt ?? new \DateTime();
|
return $this->createdAt ?? new \DateTime();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ final class GSDCostObjectMapper extends DataMapperAbstract
|
||||||
*/
|
*/
|
||||||
protected static array $columns = [
|
protected static array $columns = [
|
||||||
'ROW_ID' => ['name' => 'ROW_ID', 'type' => 'int', 'internal' => 'id'],
|
'ROW_ID' => ['name' => 'ROW_ID', 'type' => 'int', 'internal' => 'id'],
|
||||||
'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||||
'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||||
'KTR' => ['name' => 'KTR', 'type' => 'string', 'internal' => 'costobject'],
|
'KTR' => ['name' => 'KTR', 'type' => 'string', 'internal' => 'costobject'],
|
||||||
'Bezeichnung' => ['name' => 'Bezeichnung', 'type' => 'string', 'internal' => 'description'],
|
'Bezeichnung' => ['name' => 'Bezeichnung', 'type' => 'string', 'internal' => 'description'],
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ final class GSDCustomer
|
||||||
* @var \DateTime
|
* @var \DateTime
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected \DateTime $createdAt;
|
protected \DateTimeImmutable $createdAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customer number
|
* Customer number
|
||||||
|
|
@ -138,7 +138,7 @@ final class GSDCustomer
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->addr = new GSDAddress();
|
$this->addr = new GSDAddress();
|
||||||
$this->createdAt = new \DateTime('now');
|
$this->createdAt = new \DateTimeImmutable('now');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ final class GSDCustomerMapper extends DataMapperAbstract
|
||||||
*/
|
*/
|
||||||
protected static array $columns = [
|
protected static array $columns = [
|
||||||
'row_id' => ['name' => 'row_id', 'type' => 'int', 'internal' => 'id'],
|
'row_id' => ['name' => 'row_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||||
'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||||
'Kundennummer' => ['name' => 'Kundennummer', 'type' => 'string', 'internal' => 'number'],
|
'Kundennummer' => ['name' => 'Kundennummer', 'type' => 'string', 'internal' => 'number'],
|
||||||
'Info' => ['name' => 'Info', 'type' => 'string', 'internal' => 'info'],
|
'Info' => ['name' => 'Info', 'type' => 'string', 'internal' => 'info'],
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ final class GSDSupplier
|
||||||
* @var \DateTime
|
* @var \DateTime
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected \DateTime $createdAt;
|
protected \DateTimeImmutable $createdAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customer number
|
* Customer number
|
||||||
|
|
@ -114,7 +114,7 @@ final class GSDSupplier
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->addr = new GSDAddress();
|
$this->addr = new GSDAddress();
|
||||||
$this->createdAt = new \DateTime('now');
|
$this->createdAt = new \DateTimeImmutable('now');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ final class GSDSupplierMapper extends DataMapperAbstract
|
||||||
*/
|
*/
|
||||||
protected static array $columns = [
|
protected static array $columns = [
|
||||||
'row_id' => ['name' => 'row_id', 'type' => 'int', 'internal' => 'id'],
|
'row_id' => ['name' => 'row_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||||
'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||||
'LieferantenNummer' => ['name' => 'LieferantenNummer', 'type' => 'string', 'internal' => 'number'],
|
'LieferantenNummer' => ['name' => 'LieferantenNummer', 'type' => 'string', 'internal' => 'number'],
|
||||||
'Info' => ['name' => 'Info', 'type' => 'string', 'internal' => 'info'],
|
'Info' => ['name' => 'Info', 'type' => 'string', 'internal' => 'info'],
|
||||||
|
|
|
||||||
200
Models/ExchangeLog.php
Normal file
200
Models/ExchangeLog.php
Normal file
|
|
@ -0,0 +1,200 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.4
|
||||||
|
*
|
||||||
|
* @package Modules\Exchange\Models
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://orange-management.org
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Modules\Exchange\Models;
|
||||||
|
|
||||||
|
use phpOMS\Contract\ArrayableInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exchange class.
|
||||||
|
*
|
||||||
|
* @package Modules\Exchange\Models
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link https://orange-management.org
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class ExchangeLog implements \JsonSerializable, ArrayableInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Article ID.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected int $id = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
private string $message = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fields.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
private array $fields = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log type.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
private int $type = ExchangeType::IMPORT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date type.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
private \DateTimeImmutable $createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->createdAt = new \DateTimeImmutableImmutable('now');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get type.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function getType() : int
|
||||||
|
{
|
||||||
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set type.
|
||||||
|
*
|
||||||
|
* @param int $type Exchange type
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function setType(int $type) : void
|
||||||
|
{
|
||||||
|
$this->type = $type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function getId() : int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function getMessage() : string
|
||||||
|
{
|
||||||
|
return $this->message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set message
|
||||||
|
*
|
||||||
|
* @param string $message Log message
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function setMessage(string $title) : void
|
||||||
|
{
|
||||||
|
$this->message = $message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get fields.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function getFields() : array
|
||||||
|
{
|
||||||
|
return $this->fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set fields.
|
||||||
|
*
|
||||||
|
* @param array $fields Exchange fields
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function setFields(array $fields) : void
|
||||||
|
{
|
||||||
|
$this->fields = $fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get created at.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function getCreatedAt() : \DateTimeInterfaceInterface
|
||||||
|
{
|
||||||
|
return $this->createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function toArray() : array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
|
'message' => $this->message,
|
||||||
|
'type' => $this->type,
|
||||||
|
'fields' => $this->fields,
|
||||||
|
'datetime' => $this->createdAt,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function jsonSerialize()
|
||||||
|
{
|
||||||
|
return $this->toArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
66
Models/ExchangeLogMapper.php
Normal file
66
Models/ExchangeLogMapper.php
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.4
|
||||||
|
*
|
||||||
|
* @package Modules\Exchange\Models
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://orange-management.org
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Modules\Exchange\Models;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exchange log mapper class.
|
||||||
|
*
|
||||||
|
* @package Modules\Exchange\Models
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link https://orange-management.org
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
final class ExchangeLogMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static array $columns = [
|
||||||
|
'exchange_log_id' => ['name' => 'exchange_log_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
|
'exchange_log_message' => ['name' => 'exchange_log_message', 'type' => 'string', 'internal' => 'message'],
|
||||||
|
'exchange_log_fields' => ['name' => 'exchange_log_fields', 'type' => 'Json', 'internal' => 'fields'],
|
||||||
|
'exchange_log_type' => ['name' => 'exchange_log_type', 'type' => 'int', 'internal' => 'type'],
|
||||||
|
'exchange_log_time' => ['name' => 'exchange_log_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model to use by the mapper.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static string $model = ExchangeLog::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static string $table = 'exchange_log';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary field name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static string $primaryField = 'exchange_log_id';
|
||||||
|
}
|
||||||
18
Models/ExchangeType.php
Executable file → Normal file
18
Models/ExchangeType.php
Executable file → Normal file
|
|
@ -27,21 +27,7 @@ use phpOMS\Stdlib\Base\Enum;
|
||||||
*/
|
*/
|
||||||
abstract class ExchangeType extends Enum
|
abstract class ExchangeType extends Enum
|
||||||
{
|
{
|
||||||
public const CUSTOMER = 1;
|
public const IMPORT = 1;
|
||||||
|
|
||||||
public const SUPPLIER = 2;
|
public const EXPORT = 2;
|
||||||
|
|
||||||
public const ARTICLE = 3;
|
|
||||||
|
|
||||||
public const BOOKING = 4;
|
|
||||||
|
|
||||||
public const ACCOUNT = 5;
|
|
||||||
|
|
||||||
public const ADDRESS = 6;
|
|
||||||
|
|
||||||
public const COSTCENTER = 7;
|
|
||||||
|
|
||||||
public const COSTOBJECT = 8;
|
|
||||||
|
|
||||||
public const INVOICE = 9;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user