mirror of
https://github.com/Karaka-Management/oms-ClientManagement.git
synced 2026-02-09 21:38:43 +00:00
fix static analysis
This commit is contained in:
parent
d6b13086b3
commit
cb0f6c1f49
|
|
@ -18,15 +18,17 @@ use Modules\Admin\Models\Account;
|
||||||
use Modules\Admin\Models\Address;
|
use Modules\Admin\Models\Address;
|
||||||
use Modules\Admin\Models\AddressMapper;
|
use Modules\Admin\Models\AddressMapper;
|
||||||
use Modules\Admin\Models\NullAccount;
|
use Modules\Admin\Models\NullAccount;
|
||||||
|
use Modules\Attribute\Models\Attribute;
|
||||||
|
use Modules\Attribute\Models\AttributeType;
|
||||||
|
use Modules\Attribute\Models\AttributeValue;
|
||||||
|
use Modules\Attribute\Models\NullAttributeType;
|
||||||
|
use Modules\Attribute\Models\NullAttributeValue;
|
||||||
use Modules\Auditor\Models\Audit;
|
use Modules\Auditor\Models\Audit;
|
||||||
use Modules\Auditor\Models\AuditMapper;
|
use Modules\Auditor\Models\AuditMapper;
|
||||||
use Modules\ClientManagement\Models\Client;
|
use Modules\ClientManagement\Models\Client;
|
||||||
use Modules\ClientManagement\Models\ClientAttribute;
|
|
||||||
use Modules\ClientManagement\Models\ClientAttributeMapper;
|
use Modules\ClientManagement\Models\ClientAttributeMapper;
|
||||||
use Modules\ClientManagement\Models\ClientAttributeType;
|
|
||||||
use Modules\ClientManagement\Models\ClientAttributeTypeL11nMapper;
|
use Modules\ClientManagement\Models\ClientAttributeTypeL11nMapper;
|
||||||
use Modules\ClientManagement\Models\ClientAttributeTypeMapper;
|
use Modules\ClientManagement\Models\ClientAttributeTypeMapper;
|
||||||
use Modules\ClientManagement\Models\ClientAttributeValue;
|
|
||||||
use Modules\ClientManagement\Models\ClientAttributeValueL11nMapper;
|
use Modules\ClientManagement\Models\ClientAttributeValueL11nMapper;
|
||||||
use Modules\ClientManagement\Models\ClientAttributeValueMapper;
|
use Modules\ClientManagement\Models\ClientAttributeValueMapper;
|
||||||
use Modules\ClientManagement\Models\ClientL11n;
|
use Modules\ClientManagement\Models\ClientL11n;
|
||||||
|
|
@ -34,8 +36,7 @@ use Modules\ClientManagement\Models\ClientL11nMapper;
|
||||||
use Modules\ClientManagement\Models\ClientL11nType;
|
use Modules\ClientManagement\Models\ClientL11nType;
|
||||||
use Modules\ClientManagement\Models\ClientL11nTypeMapper;
|
use Modules\ClientManagement\Models\ClientL11nTypeMapper;
|
||||||
use Modules\ClientManagement\Models\ClientMapper;
|
use Modules\ClientManagement\Models\ClientMapper;
|
||||||
use Modules\ClientManagement\Models\NullClientAttributeType;
|
use Modules\ClientManagement\Models\NullClient;
|
||||||
use Modules\ClientManagement\Models\NullClientAttributeValue;
|
|
||||||
use Modules\ClientManagement\Models\NullClientL11nType;
|
use Modules\ClientManagement\Models\NullClientL11nType;
|
||||||
use Modules\Media\Models\MediaMapper;
|
use Modules\Media\Models\MediaMapper;
|
||||||
use Modules\Media\Models\PathSettings;
|
use Modules\Media\Models\PathSettings;
|
||||||
|
|
@ -65,6 +66,16 @@ use phpOMS\Utils\StringUtils;
|
||||||
*/
|
*/
|
||||||
final class ApiController extends Controller
|
final class ApiController extends Controller
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Find client by account
|
||||||
|
*
|
||||||
|
* @param int $account Account id
|
||||||
|
* @param int $unit Unit id
|
||||||
|
*
|
||||||
|
* @return null|Client
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function findClientForAccount(int $account, int $unit = null) : ?Client
|
public function findClientForAccount(int $account, int $unit = null) : ?Client
|
||||||
{
|
{
|
||||||
$clientMapper = ClientMapper::get()
|
$clientMapper = ClientMapper::get()
|
||||||
|
|
@ -77,7 +88,7 @@ final class ApiController extends Controller
|
||||||
/** @var \Modules\ClientManagement\Models\Client $client */
|
/** @var \Modules\ClientManagement\Models\Client $client */
|
||||||
$client = $clientMapper->execute();
|
$client = $clientMapper->execute();
|
||||||
|
|
||||||
return $client instanceof NullAccount ? null : $client;
|
return $client instanceof NullClient ? null : $client;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -117,8 +128,8 @@ final class ApiController extends Controller
|
||||||
|
|
||||||
if (\in_array($client->mainAddress->getCountry(), ISO3166CharEnum::getRegion('eu'))) {
|
if (\in_array($client->mainAddress->getCountry(), ISO3166CharEnum::getRegion('eu'))) {
|
||||||
$validate = EUVATVies::validateQualified(
|
$validate = EUVATVies::validateQualified(
|
||||||
|
$request->getDataString('vat_id') ?? '',
|
||||||
$unit->getAttribute('vat_id')?->value->getValue() ?? '',
|
$unit->getAttribute('vat_id')?->value->getValue() ?? '',
|
||||||
$request->getData('vat_id'),
|
|
||||||
$client->account->name1,
|
$client->account->name1,
|
||||||
$client->mainAddress->city,
|
$client->mainAddress->city,
|
||||||
$client->mainAddress->postal,
|
$client->mainAddress->postal,
|
||||||
|
|
@ -146,7 +157,7 @@ final class ApiController extends Controller
|
||||||
&& $validate['city'] === true)
|
&& $validate['city'] === true)
|
||||||
|| $validate['status'] !== 0 // Api out of order -> accept it -> @todo: test it during invoice creation
|
|| $validate['status'] !== 0 // Api out of order -> accept it -> @todo: test it during invoice creation
|
||||||
) {
|
) {
|
||||||
/** @var \Modules\ClientManagement\Models\ClientAttributeType $type */
|
/** @var \Modules\Attribute\Models\AttributeType $type */
|
||||||
$type = ClientAttributeTypeMapper::get()->where('name', 'vat_id')->execute();
|
$type = ClientAttributeTypeMapper::get()->where('name', 'vat_id')->execute();
|
||||||
|
|
||||||
$internalRequest = new HttpRequest(new HttpUri(''));
|
$internalRequest = new HttpRequest(new HttpUri(''));
|
||||||
|
|
@ -169,7 +180,7 @@ final class ApiController extends Controller
|
||||||
->where('id', $this->app->unitId)
|
->where('id', $this->app->unitId)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
/** @var \Modules\ClientManagement\Models\ClientAttributeType $type */
|
/** @var \Modules\Attribute\Models\AttributeType $type */
|
||||||
$type = ClientAttributeTypeMapper::get()
|
$type = ClientAttributeTypeMapper::get()
|
||||||
->where('name', 'sales_tax_code')
|
->where('name', 'sales_tax_code')
|
||||||
->execute();
|
->execute();
|
||||||
|
|
@ -283,6 +294,7 @@ final class ApiController extends Controller
|
||||||
->where('unit', $request->getDataInt('unit'));
|
->where('unit', $request->getDataInt('unit'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var \Modules\ClientManagement\Models\Client $client */
|
||||||
$client = $clientMapper->execute();
|
$client = $clientMapper->execute();
|
||||||
|
|
||||||
$old = $client->mainAddress;
|
$old = $client->mainAddress;
|
||||||
|
|
@ -508,18 +520,18 @@ final class ApiController extends Controller
|
||||||
*
|
*
|
||||||
* @param RequestAbstract $request Request
|
* @param RequestAbstract $request Request
|
||||||
*
|
*
|
||||||
* @return ClientAttribute
|
* @return Attribute
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private function createClientAttributeFromRequest(RequestAbstract $request) : ClientAttribute
|
private function createClientAttributeFromRequest(RequestAbstract $request) : Attribute
|
||||||
{
|
{
|
||||||
$attribute = new ClientAttribute();
|
$attribute = new Attribute();
|
||||||
$attribute->client = (int) $request->getData('client');
|
$attribute->ref = (int) $request->getData('client');
|
||||||
$attribute->type = new NullClientAttributeType((int) $request->getData('type'));
|
$attribute->type = new NullAttributeType((int) $request->getData('type'));
|
||||||
|
|
||||||
if ($request->hasData('value')) {
|
if ($request->hasData('value')) {
|
||||||
$attribute->value = new NullClientAttributeValue((int) $request->getData('value'));
|
$attribute->value = new NullAttributeValue((int) $request->getData('value'));
|
||||||
} else {
|
} else {
|
||||||
$newRequest = clone $request;
|
$newRequest = clone $request;
|
||||||
$newRequest->setData('value', $request->getData('custom'), true);
|
$newRequest->setData('value', $request->getData('custom'), true);
|
||||||
|
|
@ -656,13 +668,13 @@ final class ApiController extends Controller
|
||||||
*
|
*
|
||||||
* @param RequestAbstract $request Request
|
* @param RequestAbstract $request Request
|
||||||
*
|
*
|
||||||
* @return ClientAttributeType
|
* @return AttributeType
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private function createClientAttributeTypeFromRequest(RequestAbstract $request) : ClientAttributeType
|
private function createClientAttributeTypeFromRequest(RequestAbstract $request) : AttributeType
|
||||||
{
|
{
|
||||||
$attrType = new ClientAttributeType($request->getDataString('name') ?? '');
|
$attrType = new AttributeType($request->getDataString('name') ?? '');
|
||||||
$attrType->datatype = $request->getDataInt('datatype') ?? 0;
|
$attrType->datatype = $request->getDataInt('datatype') ?? 0;
|
||||||
$attrType->custom = $request->getDataBool('custom') ?? false;
|
$attrType->custom = $request->getDataBool('custom') ?? false;
|
||||||
$attrType->isRequired = (bool) ($request->getData('is_required') ?? false);
|
$attrType->isRequired = (bool) ($request->getData('is_required') ?? false);
|
||||||
|
|
@ -736,18 +748,18 @@ final class ApiController extends Controller
|
||||||
*
|
*
|
||||||
* @param RequestAbstract $request Request
|
* @param RequestAbstract $request Request
|
||||||
*
|
*
|
||||||
* @return ClientAttributeValue
|
* @return AttributeValue
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private function createClientAttributeValueFromRequest(RequestAbstract $request) : ClientAttributeValue
|
private function createClientAttributeValueFromRequest(RequestAbstract $request) : AttributeValue
|
||||||
{
|
{
|
||||||
/** @var ClientAttributeType $type */
|
/** @var AttributeType $type */
|
||||||
$type = ClientAttributeTypeMapper::get()
|
$type = ClientAttributeTypeMapper::get()
|
||||||
->where('id', $request->getDataInt('type') ?? 0)
|
->where('id', $request->getDataInt('type') ?? 0)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$attrValue = new ClientAttributeValue();
|
$attrValue = new AttributeValue();
|
||||||
$attrValue->isDefault = $request->getDataBool('default') ?? false;
|
$attrValue->isDefault = $request->getDataBool('default') ?? false;
|
||||||
$attrValue->setValue($request->getData('value'), $type->datatype);
|
$attrValue->setValue($request->getData('value'), $type->datatype);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ final class BackendController extends Controller
|
||||||
$view->setTemplate('/Modules/ClientManagement/Theme/Backend/attribute-type-list');
|
$view->setTemplate('/Modules/ClientManagement/Theme/Backend/attribute-type-list');
|
||||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
|
||||||
|
|
||||||
/** @var \Modules\ClientManagement\Models\ClientAttributeType[] $attributes */
|
/** @var \Modules\Attribute\Models\AttributeType[] $attributes */
|
||||||
$attributes = ClientAttributeTypeMapper::getAll()
|
$attributes = ClientAttributeTypeMapper::getAll()
|
||||||
->with('l11n')
|
->with('l11n')
|
||||||
->where('l11n/language', $response->getLanguage())
|
->where('l11n/language', $response->getLanguage())
|
||||||
|
|
@ -87,7 +87,7 @@ final class BackendController extends Controller
|
||||||
$view->setTemplate('/Modules/ClientManagement/Theme/Backend/attribute-value-list');
|
$view->setTemplate('/Modules/ClientManagement/Theme/Backend/attribute-value-list');
|
||||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
|
||||||
|
|
||||||
/** @var \Modules\ClientManagement\Models\ClientAttributeValue[] $attributes */
|
/** @var \Modules\Attribute\Models\AttributeValue[] $attributes */
|
||||||
$attributes = ClientAttributeValueMapper::getAll()
|
$attributes = ClientAttributeValueMapper::getAll()
|
||||||
->with('l11n')
|
->with('l11n')
|
||||||
->where('l11n/language', $response->getLanguage())
|
->where('l11n/language', $response->getLanguage())
|
||||||
|
|
@ -116,7 +116,7 @@ final class BackendController extends Controller
|
||||||
$view->setTemplate('/Modules/ClientManagement/Theme/Backend/attribute-type');
|
$view->setTemplate('/Modules/ClientManagement/Theme/Backend/attribute-type');
|
||||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
|
||||||
|
|
||||||
/** @var \Modules\ClientManagement\Models\ClientAttributeType $attribute */
|
/** @var \Modules\Attribute\Models\AttributeType $attribute */
|
||||||
$attribute = ClientAttributeTypeMapper::get()
|
$attribute = ClientAttributeTypeMapper::get()
|
||||||
->with('l11n')
|
->with('l11n')
|
||||||
->where('id', (int) $request->getData('id'))
|
->where('id', (int) $request->getData('id'))
|
||||||
|
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Karaka
|
|
||||||
*
|
|
||||||
* PHP Version 8.1
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Modules\ClientManagement\Models;
|
|
||||||
|
|
||||||
use phpOMS\Stdlib\Base\Enum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attribute value type enum.
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
abstract class AttributeValueType extends Enum
|
|
||||||
{
|
|
||||||
public const _INT = 1;
|
|
||||||
|
|
||||||
public const _STRING = 2;
|
|
||||||
|
|
||||||
public const _FLOAT = 3;
|
|
||||||
|
|
||||||
public const _DATETIME = 4;
|
|
||||||
|
|
||||||
public const _BOOL = 5;
|
|
||||||
|
|
||||||
public const _FLOAT_INT = 6;
|
|
||||||
}
|
|
||||||
|
|
@ -54,7 +54,7 @@ class Client
|
||||||
/**
|
/**
|
||||||
* Attributes.
|
* Attributes.
|
||||||
*
|
*
|
||||||
* @var ClientAttribute[]
|
* @var \Modules\Attribute\Models\Attribute[]
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private array $attributes = [];
|
private array $attributes = [];
|
||||||
|
|
@ -261,52 +261,6 @@ class Client
|
||||||
return $this->partners;
|
return $this->partners;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add attribute to client
|
|
||||||
*
|
|
||||||
* @param ClientAttribute $attribute Attribute
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function addAttribute(ClientAttribute $attribute) : void
|
|
||||||
{
|
|
||||||
$this->attributes[] = $attribute;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get attributes
|
|
||||||
*
|
|
||||||
* @return ClientAttribute[]
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getAttributes() : array
|
|
||||||
{
|
|
||||||
return $this->attributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get attribute
|
|
||||||
*
|
|
||||||
* @param string $attrName Attribute name
|
|
||||||
*
|
|
||||||
* @return null|ClientAttribute
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getAttribute(string $attrName) : ?ClientAttribute
|
|
||||||
{
|
|
||||||
foreach ($this->attributes as $attribute) {
|
|
||||||
if ($attribute->type->name === $attrName) {
|
|
||||||
return $attribute;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get payments
|
* Get payments
|
||||||
*
|
*
|
||||||
|
|
@ -478,4 +432,6 @@ class Client
|
||||||
{
|
{
|
||||||
return $this->toArray();
|
return $this->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use \Modules\Attribute\Models\AttributeHolderTrait;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,102 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Karaka
|
|
||||||
*
|
|
||||||
* PHP Version 8.1
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Modules\ClientManagement\Models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Client class.
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
class ClientAttribute implements \JsonSerializable
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Id.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected int $id = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Client this attribute belongs to
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public int $client = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attribute type the attribute belongs to
|
|
||||||
*
|
|
||||||
* @var ClientAttributeType
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public ClientAttributeType $type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attribute value the attribute belongs to
|
|
||||||
*
|
|
||||||
* @var ClientAttributeValue
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public ClientAttributeValue $value;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->type = new ClientAttributeType();
|
|
||||||
$this->value = new ClientAttributeValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get id
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getId() : int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function toArray() : array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'id' => $this->id,
|
|
||||||
'client' => $this->client,
|
|
||||||
'type' => $this->type,
|
|
||||||
'value' => $this->value,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function jsonSerialize() : mixed
|
|
||||||
{
|
|
||||||
return $this->toArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\ClientManagement\Models;
|
namespace Modules\ClientManagement\Models;
|
||||||
|
|
||||||
|
use Modules\Attribute\Models\Attribute;
|
||||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -34,7 +35,7 @@ final class ClientAttributeMapper extends DataMapperFactory
|
||||||
*/
|
*/
|
||||||
public const COLUMNS = [
|
public const COLUMNS = [
|
||||||
'clientmgmt_client_attr_id' => ['name' => 'clientmgmt_client_attr_id', 'type' => 'int', 'internal' => 'id'],
|
'clientmgmt_client_attr_id' => ['name' => 'clientmgmt_client_attr_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'clientmgmt_client_attr_client' => ['name' => 'clientmgmt_client_attr_client', 'type' => 'int', 'internal' => 'client'],
|
'clientmgmt_client_attr_client' => ['name' => 'clientmgmt_client_attr_client', 'type' => 'int', 'internal' => 'ref'],
|
||||||
'clientmgmt_client_attr_type' => ['name' => 'clientmgmt_client_attr_type', 'type' => 'int', 'internal' => 'type'],
|
'clientmgmt_client_attr_type' => ['name' => 'clientmgmt_client_attr_type', 'type' => 'int', 'internal' => 'type'],
|
||||||
'clientmgmt_client_attr_value' => ['name' => 'clientmgmt_client_attr_value', 'type' => 'int', 'internal' => 'value'],
|
'clientmgmt_client_attr_value' => ['name' => 'clientmgmt_client_attr_value', 'type' => 'int', 'internal' => 'value'],
|
||||||
];
|
];
|
||||||
|
|
@ -47,15 +48,23 @@ final class ClientAttributeMapper extends DataMapperFactory
|
||||||
*/
|
*/
|
||||||
public const OWNS_ONE = [
|
public const OWNS_ONE = [
|
||||||
'type' => [
|
'type' => [
|
||||||
'mapper' => ClientAttributeTypeMapper::class,
|
'mapper' => ClientAttributeTypeMapper::class,
|
||||||
'external' => 'clientmgmt_client_attr_type',
|
'external' => 'clientmgmt_client_attr_type',
|
||||||
],
|
],
|
||||||
'value' => [
|
'value' => [
|
||||||
'mapper' => ClientAttributeValueMapper::class,
|
'mapper' => ClientAttributeValueMapper::class,
|
||||||
'external' => 'clientmgmt_client_attr_value',
|
'external' => 'clientmgmt_client_attr_value',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model to use by the mapper.
|
||||||
|
*
|
||||||
|
* @var class-string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public const MODEL = Attribute::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Primary table.
|
* Primary table.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,210 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Karaka
|
|
||||||
*
|
|
||||||
* PHP Version 8.1
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Modules\ClientManagement\Models;
|
|
||||||
|
|
||||||
use phpOMS\Localization\BaseStringL11n;
|
|
||||||
use phpOMS\Localization\ISO639x1Enum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Client Attribute Type class.
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
class ClientAttributeType implements \JsonSerializable
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Id
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected int $id = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name/string identifier by which it can be found/categorized
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public string $name = ''; // @todo: currently not filled, should be used as identifier or if not required removed (at the moment it seems like it is useless?!)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Which field data type is required (string, int, ...) in the value
|
|
||||||
* @todo create enum for this
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public int $fields = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is a custom value allowed (e.g. custom string)
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public bool $custom = false;
|
|
||||||
|
|
||||||
public string $validationPattern = '';
|
|
||||||
|
|
||||||
public bool $isRequired = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Datatype of the attribute
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public int $datatype = AttributeValueType::_STRING;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Localization
|
|
||||||
*
|
|
||||||
* @var string | BaseStringL11n
|
|
||||||
*/
|
|
||||||
protected string | BaseStringL11n $l11n;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Possible default attribute values
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected array $defaults = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @param string $name Name/identifier of the attribute type
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function __construct(string $name = '')
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get id
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getId() : int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDefaultByValue(mixed $value) : ClientAttributeValue
|
|
||||||
{
|
|
||||||
foreach ($this->defaults as $default) {
|
|
||||||
if ($default->getValue() === $value) {
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new NullClientAttributeValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set l11n
|
|
||||||
*
|
|
||||||
* @param string|BaseStringL11n $l11n Tag article l11n
|
|
||||||
* @param string $lang Language
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function setL11n(string | BaseStringL11n $l11n, string $lang = ISO639x1Enum::_EN) : void
|
|
||||||
{
|
|
||||||
if ($l11n instanceof BaseStringL11n) {
|
|
||||||
$this->l11n = $l11n;
|
|
||||||
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
|
|
||||||
$this->l11n->content = $l11n;
|
|
||||||
$this->l11n->setLanguage($lang);
|
|
||||||
} else {
|
|
||||||
$this->l11n = new BaseStringL11n();
|
|
||||||
$this->l11n->content = $l11n;
|
|
||||||
$this->l11n->setLanguage($lang);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getL11n() : string
|
|
||||||
{
|
|
||||||
if (!isset($this->l11n)) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set fields
|
|
||||||
*
|
|
||||||
* @param int $fields Fields
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function setFields(int $fields) : void
|
|
||||||
{
|
|
||||||
$this->fields = $fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get default values
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @sicne 1.0.0
|
|
||||||
*/
|
|
||||||
public function getDefaults() : array
|
|
||||||
{
|
|
||||||
return $this->defaults;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function toArray() : array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'id' => $this->id,
|
|
||||||
'name' => $this->name,
|
|
||||||
'fields' => $this->fields,
|
|
||||||
'custom' => $this->custom,
|
|
||||||
'validationPattern' => $this->validationPattern,
|
|
||||||
'isRequired' => $this->isRequired,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function jsonSerialize() : mixed
|
|
||||||
{
|
|
||||||
return $this->toArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\ClientManagement\Models;
|
namespace Modules\ClientManagement\Models;
|
||||||
|
|
||||||
|
use Modules\Attribute\Models\AttributeType;
|
||||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -64,6 +65,14 @@ final class ClientAttributeTypeMapper extends DataMapperFactory
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model to use by the mapper.
|
||||||
|
*
|
||||||
|
* @var class-string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public const MODEL = AttributeType::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Primary table.
|
* Primary table.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,230 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Karaka
|
|
||||||
*
|
|
||||||
* PHP Version 8.1
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Modules\ClientManagement\Models;
|
|
||||||
|
|
||||||
use phpOMS\Localization\BaseStringL11n;
|
|
||||||
use phpOMS\Localization\ISO639x1Enum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Client attribute value class.
|
|
||||||
*
|
|
||||||
* The relation with the type/client is defined in the ClientAttribute class.
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
class ClientAttributeValue implements \JsonSerializable
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Id
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected int $id = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Depending attribute type
|
|
||||||
*
|
|
||||||
* @var null|int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public ?int $dependingAttributeType = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Depending attribute value
|
|
||||||
*
|
|
||||||
* @var null|int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public ?int $dependingAttributeValue = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Int value
|
|
||||||
*
|
|
||||||
* @var null|int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public ?int $valueInt = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* String value
|
|
||||||
*
|
|
||||||
* @var null|string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public ?string $valueStr = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decimal value
|
|
||||||
*
|
|
||||||
* @var null|float
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public ?float $valueDec = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DateTime value
|
|
||||||
*
|
|
||||||
* @var null|\DateTimeInterface
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public ?\DateTimeInterface $valueDat = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is a default value which can be selected
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public bool $isDefault = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unit of the value
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public string $unit = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Localization
|
|
||||||
*
|
|
||||||
* @var null|BaseStringL11n
|
|
||||||
*/
|
|
||||||
private ?BaseStringL11n $l11n = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get id
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getId() : int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set l11n
|
|
||||||
*
|
|
||||||
* @param string|BaseStringL11n $l11n Tag article l11n
|
|
||||||
* @param string $lang Language
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function setL11n(string | BaseStringL11n $l11n, string $lang = ISO639x1Enum::_EN) : void
|
|
||||||
{
|
|
||||||
if ($l11n instanceof BaseStringL11n) {
|
|
||||||
$this->l11n = $l11n;
|
|
||||||
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
|
|
||||||
$this->l11n->content = $l11n;
|
|
||||||
$this->l11n->setLanguage($lang);
|
|
||||||
} else {
|
|
||||||
$this->l11n = new BaseStringL11n();
|
|
||||||
$this->l11n->content = $l11n;
|
|
||||||
$this->l11n->ref = $this->id;
|
|
||||||
$this->l11n->setLanguage($lang);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get localization
|
|
||||||
*
|
|
||||||
* @return null|string
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getL11n() : ?string
|
|
||||||
{
|
|
||||||
return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set value
|
|
||||||
*
|
|
||||||
* @param int|string|float $value Value
|
|
||||||
* @param int $datatype Datatype
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function setValue(mixed $value, int $datatype) : void
|
|
||||||
{
|
|
||||||
if ($datatype === AttributeValueType::_STRING) {
|
|
||||||
$this->valueStr = (string) $value;
|
|
||||||
} elseif ($datatype === AttributeValueType::_INT
|
|
||||||
|| $datatype === AttributeValueType::_FLOAT_INT
|
|
||||||
|| $datatype === AttributeValueType::_BOOL
|
|
||||||
) {
|
|
||||||
$this->valueInt = (int) $value;
|
|
||||||
} elseif ($datatype === AttributeValueType::_FLOAT) {
|
|
||||||
$this->valueDec = (float) $value;
|
|
||||||
} elseif ($datatype === AttributeValueType::_DATETIME) {
|
|
||||||
$this->valueDat = new \DateTime((string) $value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get value
|
|
||||||
*
|
|
||||||
* @return null|int|string|float|\DateTimeInterface
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function getValue() : mixed
|
|
||||||
{
|
|
||||||
if (!empty($this->valueStr)) {
|
|
||||||
return $this->valueStr;
|
|
||||||
} elseif (!empty($this->valueInt)) {
|
|
||||||
return $this->valueInt;
|
|
||||||
} elseif (!empty($this->valueDec)) {
|
|
||||||
return $this->valueDec;
|
|
||||||
} elseif ($this->valueDat instanceof \DateTimeInterface) {
|
|
||||||
return $this->valueDat;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function toArray() : array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'id' => $this->id,
|
|
||||||
'valueInt' => $this->valueInt,
|
|
||||||
'valueStr' => $this->valueStr,
|
|
||||||
'valueDec' => $this->valueDec,
|
|
||||||
'valueDat' => $this->valueDat,
|
|
||||||
'isDefault' => $this->isDefault,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function jsonSerialize() : mixed
|
|
||||||
{
|
|
||||||
return $this->toArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\ClientManagement\Models;
|
namespace Modules\ClientManagement\Models;
|
||||||
|
|
||||||
|
use Modules\Attribute\Models\AttributeValue;
|
||||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -59,6 +60,14 @@ final class ClientAttributeValueMapper extends DataMapperFactory
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model to use by the mapper.
|
||||||
|
*
|
||||||
|
* @var class-string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public const MODEL = AttributeValue::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Primary table.
|
* Primary table.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Karaka
|
|
||||||
*
|
|
||||||
* PHP Version 8.1
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Modules\ClientManagement\Models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Null model
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
final class NullClientAttribute extends ClientAttribute
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param int $id Model id
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function __construct(int $id = 0)
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
$this->id = $id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function jsonSerialize() : mixed
|
|
||||||
{
|
|
||||||
return ['id' => $this->id];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Karaka
|
|
||||||
*
|
|
||||||
* PHP Version 8.1
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Modules\ClientManagement\Models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Null model
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
final class NullClientAttributeType extends ClientAttributeType
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param int $id Model id
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function __construct(int $id = 0)
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function jsonSerialize() : mixed
|
|
||||||
{
|
|
||||||
return ['id' => $this->id];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Karaka
|
|
||||||
*
|
|
||||||
* PHP Version 8.1
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Modules\ClientManagement\Models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Null model
|
|
||||||
*
|
|
||||||
* @package Modules\ClientManagement\Models
|
|
||||||
* @license OMS License 2.0
|
|
||||||
* @link https://jingga.app
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
final class NullClientAttributeValue extends ClientAttributeValue
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param int $id Model id
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function __construct(int $id = 0)
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function jsonSerialize() : mixed
|
|
||||||
{
|
|
||||||
return ['id' => $this->id];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user