fix: update table scheme

This commit is contained in:
Maël Gangloff
2024-07-11 02:29:08 +02:00
parent 9cc575ff09
commit fbb14df399
14 changed files with 711 additions and 56 deletions

View 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;
}
}