feat: add createdAt to Connector and Watchlist

This commit is contained in:
Maël Gangloff
2024-08-03 01:40:18 +02:00
parent af6bf4eebd
commit e26360a523
7 changed files with 88 additions and 4 deletions

View File

@@ -60,6 +60,10 @@ class Connector
#[ORM\OneToMany(targetEntity: WatchList::class, mappedBy: 'connector')]
private Collection $watchLists;
#[Groups(['connector:list', 'watchlist:list'])]
#[ORM\Column]
private ?\DateTimeImmutable $createdAt = null;
public function __construct()
{
$this->id = Uuid::v4();
@@ -136,4 +140,16 @@ class Connector
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
}

View File

@@ -97,11 +97,20 @@ class WatchList
#[Groups(['watchlist:list', 'watchlist:item', 'watchlist:create', 'watchlist:update'])]
private ?Connector $connector = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(['watchlist:list', 'watchlist:item', 'watchlist:create', 'watchlist:update'])]
private ?string $name = null;
#[ORM\Column]
#[Groups(['watchlist:list', 'watchlist:item'])]
private ?\DateTimeImmutable $createdAt = null;
public function __construct()
{
$this->token = Uuid::v4();
$this->domains = new ArrayCollection();
$this->watchListTriggers = new ArrayCollection();
$this->createdAt = new \DateTimeImmutable('now');
}
public function getToken(): ?string
@@ -186,4 +195,28 @@ class WatchList
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): static
{
$this->name = $name;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
}