20241102#1
This commit is contained in:
17
application/base/Domain/AbstractObject.php
Normal file
17
application/base/Domain/AbstractObject.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Zuev Yuri
|
||||
*/
|
||||
|
||||
namespace Base\Domain;
|
||||
|
||||
abstract class AbstractObject implements EntityInterface {
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId(): mixed {
|
||||
return (isset($this->id)) ? (($this->id instanceof ValueObjectInterface) ? $this->id->get() : $this->id) : null;
|
||||
}
|
||||
}
|
||||
15
application/base/Domain/DomainException.php
Normal file
15
application/base/Domain/DomainException.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Base\Domain;
|
||||
|
||||
use Throwable;
|
||||
|
||||
class DomainException extends \Exception {
|
||||
|
||||
public array $data;
|
||||
|
||||
public function __construct($message="", $code=0, array $data = [], Throwable $previous=null) {
|
||||
parent::__construct($message, $code, $previous);
|
||||
$this->data = $data;
|
||||
}
|
||||
}
|
||||
18
application/base/Domain/EntityInterface.php
Normal file
18
application/base/Domain/EntityInterface.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Zuev Yuri
|
||||
* Date: 23.04.2024
|
||||
* Time: 3:58
|
||||
*/
|
||||
|
||||
namespace Base\Domain;
|
||||
|
||||
interface EntityInterface {
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId(): mixed;
|
||||
|
||||
}
|
||||
16
application/base/Domain/ValueObjectInterface.php
Normal file
16
application/base/Domain/ValueObjectInterface.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Zuev Yuri
|
||||
* Date: 23.04.2024
|
||||
* Time: 3:58
|
||||
*/
|
||||
|
||||
namespace Base\Domain;
|
||||
|
||||
interface ValueObjectInterface {
|
||||
|
||||
public function get();
|
||||
public function __toString(): string;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user