mirror of
https://forge.chapril.org/tykayn/caisse-bliss
synced 2025-06-20 01:44:42 +02:00
add api platform to entitites
This commit is contained in:
parent
c44ac9c522
commit
9c9f8984af
15 changed files with 13 additions and 369 deletions
|
@ -10,7 +10,9 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
|
||||
#[ApiResource(paginationEnabled: false)]
|
||||
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
||||
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_EMAIL', fields: ['email'])]
|
||||
#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]
|
||||
|
@ -75,12 +77,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||
#[ORM\OneToMany(targetEntity: Festival::class, mappedBy: 'user')]
|
||||
private Collection $festivals;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Category>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Category::class, mappedBy: 'user')]
|
||||
private Collection $categories;
|
||||
|
||||
/**
|
||||
* @var Collection<int, SerieFestival>
|
||||
*/
|
||||
|
@ -94,7 +90,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||
$this->products = new ArrayCollection();
|
||||
$this->groupOfProducts = new ArrayCollection();
|
||||
$this->festivals = new ArrayCollection();
|
||||
$this->categories = new ArrayCollection();
|
||||
$this->seriesFestival = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
@ -173,18 +168,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||
// $this->plainPassword = null;
|
||||
}
|
||||
|
||||
public function getOwner(): ?object
|
||||
{
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
public function setOwner(object $owner): static
|
||||
{
|
||||
$this->owner = $owner;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getExpenses(): ?object
|
||||
{
|
||||
return $this->expenses;
|
||||
|
@ -333,35 +316,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Category>
|
||||
*/
|
||||
public function getCategories(): Collection
|
||||
{
|
||||
return $this->categories;
|
||||
}
|
||||
|
||||
public function addCategory(Category $category): static
|
||||
{
|
||||
if (!$this->categories->contains($category)) {
|
||||
$this->categories->add($category);
|
||||
$category->setUser($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCategory(Category $category): static
|
||||
{
|
||||
if ($this->categories->removeElement($category)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($category->getUser() === $this) {
|
||||
$category->setUser(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, SerieFestival>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue