mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
fix: update table scheme
This commit is contained in:
74
src/Entity/BookmarkDomainList.php
Normal file
74
src/Entity/BookmarkDomainList.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\BookmarkDomainListRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
#[ORM\Entity(repositoryClass: BookmarkDomainListRepository::class)]
|
||||
class BookmarkDomainList
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(length: 36)]
|
||||
private string $token;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'bookmarkDomainLists')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $user = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Domain>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: Domain::class, mappedBy: 'ldhname')]
|
||||
private Collection $domains;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->token = Uuid::v4();
|
||||
$this->domains = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getToken(): ?string
|
||||
{
|
||||
return $this->token;
|
||||
}
|
||||
|
||||
public function getUser(): ?User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function setUser(?User $user): static
|
||||
{
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Domain>
|
||||
*/
|
||||
public function getDomains(): Collection
|
||||
{
|
||||
return $this->domains;
|
||||
}
|
||||
|
||||
public function addDomain(Domain $domain): static
|
||||
{
|
||||
if (!$this->domains->contains($domain)) {
|
||||
$this->domains->add($domain);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeDomain(Domain $domain): static
|
||||
{
|
||||
$this->domains->removeElement($domain);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user