mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: add WatchListTrigger Entity
This commit is contained in:
64
src/Entity/WatchListTrigger.php
Normal file
64
src/Entity/WatchListTrigger.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Config\EventAction;
|
||||
use App\Config\TriggerAction;
|
||||
use App\Repository\EventTriggerRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
|
||||
#[ORM\Entity(repositoryClass: EventTriggerRepository::class)]
|
||||
class WatchListTrigger
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(enumType: EventAction::class)]
|
||||
#[Groups(['watchlist:item', 'watchlist:create', 'watchlist:update'])]
|
||||
private ?EventAction $event = null;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\ManyToOne(targetEntity: WatchList::class, inversedBy: 'watchListTriggers')]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'token', nullable: false)]
|
||||
private ?WatchList $watchList = null;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(enumType: TriggerAction::class)]
|
||||
#[Groups(['watchlist:item', 'watchlist:create', 'watchlist:update'])]
|
||||
private ?TriggerAction $action = null;
|
||||
|
||||
public function getEvent(): ?EventAction
|
||||
{
|
||||
return $this->event;
|
||||
}
|
||||
|
||||
public function setEvent(EventAction $event): static
|
||||
{
|
||||
$this->event = $event;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWatchList(): ?WatchList
|
||||
{
|
||||
return $this->watchList;
|
||||
}
|
||||
|
||||
public function setWatchList(?WatchList $watchList): static
|
||||
{
|
||||
$this->watchList = $watchList;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAction(): ?TriggerAction
|
||||
{
|
||||
return $this->action;
|
||||
}
|
||||
|
||||
public function setAction(TriggerAction $action): static
|
||||
{
|
||||
$this->action = $action;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user