Files
domain-watchdog/src/Entity/RdapServer.php

74 lines
1.5 KiB
PHP
Raw Normal View History

2024-07-18 19:13:06 +02:00
<?php
namespace App\Entity;
use App\Repository\RdapServerRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;
2024-07-18 19:13:06 +02:00
#[ORM\Entity(repositoryClass: RdapServerRepository::class)]
class RdapServer
{
#[ORM\Id]
#[ORM\Column(length: 255)]
#[Groups(['domain:item'])]
2024-07-18 19:13:06 +02:00
private ?string $url = null;
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
2024-08-02 23:24:52 +02:00
private ?\DateTimeImmutable $updatedAt = null;
2024-07-18 19:13:06 +02:00
2024-07-19 18:59:21 +02:00
#[ORM\Id]
#[ORM\ManyToOne(inversedBy: 'rdapServers')]
#[ORM\JoinColumn(referencedColumnName: 'tld', nullable: false)]
private ?Tld $tld = null;
2024-07-18 19:13:06 +02:00
2024-07-19 18:59:21 +02:00
public function __construct()
2024-07-18 19:13:06 +02:00
{
2024-08-02 23:24:52 +02:00
$this->updatedAt = new \DateTimeImmutable('now');
2024-07-18 19:13:06 +02:00
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(string $url): static
{
$this->url = $url;
return $this;
}
2024-08-02 23:24:52 +02:00
public function getUpdatedAt(): ?\DateTimeImmutable
2024-07-18 19:13:06 +02:00
{
return $this->updatedAt;
}
2024-08-02 23:24:52 +02:00
public function setUpdatedAt(\DateTimeImmutable $updatedAt): static
2024-07-18 19:13:06 +02:00
{
$this->updatedAt = $updatedAt;
return $this;
}
#[ORM\PrePersist]
#[ORM\PreUpdate]
public function updateTimestamps(): void
{
2024-08-02 23:24:52 +02:00
$this->setUpdatedAt(new \DateTimeImmutable('now'));
2024-07-18 19:13:06 +02:00
}
2024-07-19 18:59:21 +02:00
public function getTld(): ?Tld
{
return $this->tld;
}
public function setTld(?Tld $tld): static
{
$this->tld = $tld;
return $this;
}
2024-07-18 19:13:06 +02:00
}