mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
chore: rename Bookmark WatchList
This commit is contained in:
@@ -38,10 +38,10 @@ class Domain
|
||||
private array $status = [];
|
||||
|
||||
/**
|
||||
* @var Collection<int, BookmarkList>
|
||||
* @var Collection<int, WatchList>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: BookmarkList::class, mappedBy: 'domains', cascade: ['persist'])]
|
||||
private Collection $bookmarkLists;
|
||||
#[ORM\ManyToMany(targetEntity: WatchList::class, mappedBy: 'domains', cascade: ['persist'])]
|
||||
private Collection $watchLists;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Nameserver>
|
||||
@@ -57,7 +57,7 @@ class Domain
|
||||
{
|
||||
$this->events = new ArrayCollection();
|
||||
$this->domainEntities = new ArrayCollection();
|
||||
$this->bookmarkLists = new ArrayCollection();
|
||||
$this->watchLists = new ArrayCollection();
|
||||
$this->nameservers = new ArrayCollection();
|
||||
}
|
||||
|
||||
@@ -173,27 +173,27 @@ class Domain
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, BookmarkList>
|
||||
* @return Collection<int, WatchList>
|
||||
*/
|
||||
public function getBookmarkLists(): Collection
|
||||
public function getWatchLists(): Collection
|
||||
{
|
||||
return $this->bookmarkLists;
|
||||
return $this->watchLists;
|
||||
}
|
||||
|
||||
public function addBookmarkList(BookmarkList $bookmarkList): static
|
||||
public function addWatchList(WatchList $watchList): static
|
||||
{
|
||||
if (!$this->bookmarkLists->contains($bookmarkList)) {
|
||||
$this->bookmarkLists->add($bookmarkList);
|
||||
$bookmarkList->addDomain($this);
|
||||
if (!$this->watchLists->contains($watchList)) {
|
||||
$this->watchLists->add($watchList);
|
||||
$watchList->addDomain($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeBookmarkList(BookmarkList $bookmarkList): static
|
||||
public function removeWatchList(WatchList $watchList): static
|
||||
{
|
||||
if ($this->bookmarkLists->removeElement($bookmarkList)) {
|
||||
$bookmarkList->removeDomain($this);
|
||||
if ($this->watchLists->removeElement($watchList)) {
|
||||
$watchList->removeDomain($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
||||
@@ -34,14 +34,14 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
private ?string $password = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, BookmarkList>
|
||||
* @var Collection<int, WatchList>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: BookmarkList::class, mappedBy: 'user', orphanRemoval: true)]
|
||||
private Collection $bookmarkDomainLists;
|
||||
#[ORM\OneToMany(targetEntity: WatchList::class, mappedBy: 'user', orphanRemoval: true)]
|
||||
private Collection $watchLists;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bookmarkDomainLists = new ArrayCollection();
|
||||
$this->watchLists = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -121,29 +121,29 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, BookmarkList>
|
||||
* @return Collection<int, WatchList>
|
||||
*/
|
||||
public function getBookmarkDomainLists(): Collection
|
||||
public function getWatchLists(): Collection
|
||||
{
|
||||
return $this->bookmarkDomainLists;
|
||||
return $this->watchLists;
|
||||
}
|
||||
|
||||
public function addBookmarkDomainList(BookmarkList $bookmarkDomainList): static
|
||||
public function addWatchList(WatchList $watchList): static
|
||||
{
|
||||
if (!$this->bookmarkDomainLists->contains($bookmarkDomainList)) {
|
||||
$this->bookmarkDomainLists->add($bookmarkDomainList);
|
||||
$bookmarkDomainList->setUser($this);
|
||||
if (!$this->watchLists->contains($watchList)) {
|
||||
$this->watchLists->add($watchList);
|
||||
$watchList->setUser($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeBookmarkDomainList(BookmarkList $bookmarkDomainList): static
|
||||
public function removeWatchList(WatchList $watchList): static
|
||||
{
|
||||
if ($this->bookmarkDomainLists->removeElement($bookmarkDomainList)) {
|
||||
if ($this->watchLists->removeElement($watchList)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($bookmarkDomainList->getUser() === $this) {
|
||||
$bookmarkDomainList->setUser(null);
|
||||
if ($watchList->getUser() === $this) {
|
||||
$watchList->setUser(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,29 +2,29 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\BookmarkListRepository;
|
||||
use App\Repository\WatchListRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
#[ORM\Entity(repositoryClass: BookmarkListRepository::class)]
|
||||
class BookmarkList
|
||||
#[ORM\Entity(repositoryClass: WatchListRepository::class)]
|
||||
class WatchList
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(length: 36)]
|
||||
private string $token;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'bookmarkDomainLists')]
|
||||
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'watchLists')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $user = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Domain>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: Domain::class, inversedBy: 'bookmarkLists')]
|
||||
#[ORM\JoinTable(name: 'bookmark_lists_domains',
|
||||
joinColumns: [new ORM\JoinColumn(name: 'bookmark_token', referencedColumnName: 'token')],
|
||||
#[ORM\ManyToMany(targetEntity: Domain::class, inversedBy: 'watchLists')]
|
||||
#[ORM\JoinTable(name: 'watch_lists_domains',
|
||||
joinColumns: [new ORM\JoinColumn(name: 'watch_list_token', referencedColumnName: 'token')],
|
||||
inverseJoinColumns: [new ORM\JoinColumn(name: 'domain_handle', referencedColumnName: 'handle')])]
|
||||
private Collection $domains;
|
||||
|
||||
Reference in New Issue
Block a user