diff --git a/src/Entity/Traits/IdentityBigIntTrait.php b/src/Entity/Traits/IdentityBigIntTrait.php new file mode 100644 index 0000000..a5cefab --- /dev/null +++ b/src/Entity/Traits/IdentityBigIntTrait.php @@ -0,0 +1,50 @@ + true])] + #[Serialize] + protected ?int $id = null; + + public function getId(): ?int + { + return $this->id; + } + + public function setId(?int $id): static + { + $this->id = $id; + + return $this; + } + + public function is(BaseIdentifiableInterface $identifiable): bool + { + if ($identifiable::getResourceName() === $this->getResourceName()) { + return $identifiable->getId() === $this->getId(); + } + + return false; + } + + public function isNot(BaseIdentifiableInterface $identifiable): bool + { + return false === $this->is($identifiable); + } +} diff --git a/src/Entity/Traits/IdentityTrait.php b/src/Entity/Traits/IdentityTrait.php index de9ab3c..d1313f6 100644 --- a/src/Entity/Traits/IdentityTrait.php +++ b/src/Entity/Traits/IdentityTrait.php @@ -9,6 +9,9 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +/** + * @deprecated Use IdentityIntTrait + */ trait IdentityTrait { use NamedResourceTrait;