feat: connector on watchlist

This commit is contained in:
Maël Gangloff
2024-07-30 21:34:48 +02:00
parent 73a47c7879
commit 6f89317edc
7 changed files with 114 additions and 82 deletions

View File

@@ -56,16 +56,16 @@ class Connector
private array $authData = [];
/**
* @var Collection<int, WatchListTrigger>
* @var Collection<int, WatchList>
*/
#[ORM\OneToMany(targetEntity: WatchListTrigger::class, mappedBy: 'connector')]
private Collection $watchListTriggers;
#[ORM\OneToMany(targetEntity: WatchList::class, mappedBy: 'connector')]
private Collection $watchLists;
public function __construct()
{
$this->id = Uuid::v4();
$this->watchListTriggers = new ArrayCollection();
$this->watchLists = new ArrayCollection();
}
public function getId(): ?string
@@ -97,36 +97,6 @@ class Connector
return $this;
}
/**
* @return Collection<int, WatchListTrigger>
*/
public function getWatchListTriggers(): Collection
{
return $this->watchListTriggers;
}
public function addWatchListTrigger(WatchListTrigger $watchListTrigger): static
{
if (!$this->watchListTriggers->contains($watchListTrigger)) {
$this->watchListTriggers->add($watchListTrigger);
$watchListTrigger->setConnector($this);
}
return $this;
}
public function removeWatchListTrigger(WatchListTrigger $watchListTrigger): static
{
if ($this->watchListTriggers->removeElement($watchListTrigger)) {
// set the owning side to null (unless already changed)
if ($watchListTrigger->getConnector() === $this) {
$watchListTrigger->setConnector(null);
}
}
return $this;
}
public function getProvider(): ?ConnectorProvider
{
return $this->provider;
@@ -139,4 +109,34 @@ class Connector
return $this;
}
/**
* @return Collection<int, WatchList>
*/
public function getWatchLists(): Collection
{
return $this->watchLists;
}
public function addWatchList(WatchList $watchList): static
{
if (!$this->watchLists->contains($watchList)) {
$this->watchLists->add($watchList);
$watchList->setConnector($this);
}
return $this;
}
public function removeWatchList(WatchList $watchList): static
{
if ($this->watchLists->removeElement($watchList)) {
// set the owning side to null (unless already changed)
if ($watchList->getConnector() === $this) {
$watchList->setConnector(null);
}
}
return $this;
}
}