<?phpnamespace App\Entity;use App\Repository\RedirectionRepository;use App\Traits\EntityDateTimeAbleTrait;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: RedirectionRepository::class)]#[ORM\HasLifecycleCallbacks]class Redirection{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; #[ORM\Column(type: 'string', length: 100, nullable: true)] private ?string $entityName = null; #[ORM\Column(type: 'integer', nullable: true)] private ?int $entityId = null; #[ORM\Column(type: 'string', length: 500, nullable: true)] private ?string $oldUrl = null; #[ORM\Column(type: 'string', length: 500, nullable: true)] private ?string $newUrl = null; #[ORM\Column(type: 'datetime', nullable: true)] private \DateTimeInterface|null|\DateTime $createdDate = null; public function getId(): ?int { return $this->id; } public function getEntityName(): ?string { return $this->entityName; } public function setEntityName(?string $entityName): self { $this->entityName = $entityName; return $this; } public function getEntityId(): ?int { return $this->entityId; } public function setEntityId(?int $entityId): self { $this->entityId = $entityId; return $this; } public function getOldUrl(): ?string { return $this->oldUrl; } public function setOldUrl(?string $oldUrl): self { $this->oldUrl = $oldUrl; return $this; } public function getCreatedDate(): ?\DateTimeInterface { return $this->createdDate; } public function setCreatedDate(?\DateTimeInterface $createdDate): self { $this->createdDate = $createdDate; return $this; } /** * Gets triggered only on insert */ #[ORM\PrePersist] public function onPrePersist() { if (!$this->createdDate) { $this->createdDate = new \DateTime('now'); } } public function getNewUrl(): ?string { return $this->newUrl; } public function setNewUrl(string $newUrl): self { $this->newUrl = $newUrl; return $this; }}