src/Entity/User.php line 17
<?phpnamespace App\Entity;use App\Repository\UserRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;use Symfony\Component\Security\Core\User\UserInterface;use Symfony\Component\Serializer\Annotation\Groups;use Symfony\Component\Uid\Uuid;#[ORM\Entity(repositoryClass: UserRepository::class)]#[ORM\Table(name: '`user`')]class User implements UserInterface, PasswordAuthenticatedUserInterface{#[ORM\Id]#[ORM\Column(type: 'uuid', unique: true)]#[Groups(['BASE'])]private ?string $id = null;#[ORM\Column(length: 255, nullable: true)]private ?string $name = null;#[ORM\Column(length: 255)]private ?string $email = null;#[ORM\Column(length: 255)]private ?string $password = null;#[ORM\OneToMany(mappedBy: 'creatorUser', targetEntity: Component::class, orphanRemoval: true)]private Collection $components;#[ORM\OneToMany(mappedBy: 'creatorUser', targetEntity: Product::class, orphanRemoval: true)]private Collection $products;#[ORM\OneToMany(mappedBy: 'creatorUser', targetEntity: Menu::class, orphanRemoval: true)]private Collection $menus;/*** @var string[]*/#[ORM\Column(type: 'json')]private $roles = [];#[ORM\ManyToOne(inversedBy: 'users')]#[ORM\JoinColumn(nullable: false)]private ?Whitelabel $whitelabel = null;#[ORM\Column(type: Types::DATETIME_MUTABLE)]private ?\DateTimeInterface $createDate = null;#[ORM\OneToMany(mappedBy: 'creatorUser', targetEntity: ProductCategory::class)]private Collection $productCategories;#[ORM\OneToMany(mappedBy: 'creatorUser', targetEntity: Allergen::class)]private Collection $allergens;#[ORM\ManyToMany(targetEntity: Property::class, inversedBy: 'users')]private Collection $properties;public function __construct(){$this->id = Uuid::v4();$this->components = new ArrayCollection();$this->products = new ArrayCollection();$this->menus = new ArrayCollection();$this->productCategories = new ArrayCollection();$this->allergens = new ArrayCollection();$this->properties = new ArrayCollection();}public function __toString(){return $this->getName();}public function getId(): ?string{return $this->id;}public function getName(): ?string{return $this->name;}public function setName(?string $name): self{$this->name = $name;return $this;}public function getEmail(): ?string{return $this->email;}public function setEmail(string $email): self{$this->email = $email;return $this;}public function getPassword(): ?string{return $this->password;}public function setPassword(string $password): self{$this->password = $password;return $this;}/*** @return Collection<int, Component>*/public function getComponents(): Collection{return $this->components;}public function addComponent(Component $component): self{if (!$this->components->contains($component)) {$this->components->add($component);$component->setCreatorUser($this);}return $this;}public function removeComponent(Component $component): self{if ($this->components->removeElement($component)) {// set the owning side to null (unless already changed)if ($component->getCreatorUser() === $this) {$component->setCreatorUser(null);}}return $this;}/*** @return Collection<int, Product>*/public function getProducts(): Collection{return $this->products;}public function addProduct(Product $product): self{if (!$this->products->contains($product)) {$this->products->add($product);$product->setCreatorUser($this);}return $this;}public function removeProduct(Product $product): self{if ($this->products->removeElement($product)) {// set the owning side to null (unless already changed)if ($product->getCreatorUser() === $this) {$product->setCreatorUser(null);}}return $this;}/*** @return Collection<int, Menu>*/public function getMenus(): Collection{return $this->menus;}public function addMenu(Menu $menu): self{if (!$this->menus->contains($menu)) {$this->menus->add($menu);$menu->setCreatorUser($this);}return $this;}public function removeMenu(Menu $menu): self{if ($this->menus->removeElement($menu)) {// set the owning side to null (unless already changed)if ($menu->getCreatorUser() === $this) {$menu->setCreatorUser(null);}}return $this;}/*** A visual identifier that represents this user.** @see UserInterface*/public function getUserIdentifier(): string{return (string) $this->email;}/*** @see UserInterface*/public function getRoles(): array{$roles = $this->roles;// guarantee every user at least has ROLE_USER$roles[] = 'ROLE_USER';return array_unique($roles);}public function setRoles(array $roles): self{$this->roles = $roles;return $this;}/*** @see UserInterface*/public function eraseCredentials(){// If you store any temporary, sensitive data on the user, clear it here// $this->plainPassword = null;}/*** @see UserInterface*/public function getUsername(){// If you store any temporary, sensitive data on the user, clear it here// $this->plainPassword = null;return '';}public function getWhitelabel(): ?Whitelabel{return $this->whitelabel;}public function setWhitelabel(?Whitelabel $whitelabel): self{$this->whitelabel = $whitelabel;return $this;}public function getCreateDate(): ?\DateTimeInterface{return $this->createDate;}public function setCreateDate(\DateTimeInterface $createDate): self{$this->createDate = $createDate;return $this;}/*** @return Collection<int, ProductCategory>*/public function getProductCategories(): Collection{return $this->productCategories;}public function addProductCategory(ProductCategory $productCategory): self{if (!$this->productCategories->contains($productCategory)) {$this->productCategories->add($productCategory);$productCategory->setCreatorUser($this);}return $this;}public function removeProductCategory(ProductCategory $productCategory): self{if ($this->productCategories->removeElement($productCategory)) {// set the owning side to null (unless already changed)if ($productCategory->getCreatorUser() === $this) {$productCategory->setCreatorUser(null);}}return $this;}/*** @return Collection<int, Allergen>*/public function getAllergens(): Collection{return $this->allergens;}public function addAllergen(Allergen $allergen): self{if (!$this->allergens->contains($allergen)) {$this->allergens->add($allergen);$allergen->setCreatorUser($this);}return $this;}public function removeAllergen(Allergen $allergen): self{if ($this->allergens->removeElement($allergen)) {// set the owning side to null (unless already changed)if ($allergen->getCreatorUser() === $this) {$allergen->setCreatorUser(null);}}return $this;}/*** @return Collection<int, Property>*/public function getProperties(): Collection{return $this->properties;}public function addProperty(Property $property): static{if (!$this->properties->contains($property)) {$this->properties->add($property);}return $this;}public function removeProperty(Property $property): static{$this->properties->removeElement($property);return $this;}}