23 lines
451 B
PHP
23 lines
451 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Shared\DDD;
|
|
|
|
use Ramsey\Uuid\UuidInterface;
|
|
|
|
abstract readonly class EntityId implements \Stringable, Equatable
|
|
{
|
|
public readonly UuidInterface $value;
|
|
|
|
#[\Override]
|
|
public function __toString(): string
|
|
{
|
|
return $this->value->toString();
|
|
}
|
|
|
|
public function equals(mixed $other): bool
|
|
{
|
|
return $other instanceof self && $this->value->equals($other->value);
|
|
}
|
|
}
|