src/Entity/Whitelabel.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use App\Interface\SoftDeleteInterface;
  4. use App\Repository\WhitelabelRepository;
  5. use App\Trait\SoftDeleteTrait;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. use Symfony\Component\Uid\Uuid;
  12. #[ORM\Entity(repositoryClassWhitelabelRepository::class)]
  13. class Whitelabel implements SoftDeleteInterface
  14. {
  15.     use SoftDeleteTrait;
  16.     #[ORM\Id]
  17.     #[ORM\Column(type'uuid'uniquetrue)]
  18.     #[Groups(['BASE'])]
  19.     private ?string $id null;
  20.     #[ORM\Column(length255)]
  21.     private ?string $name null;
  22.     #[ORM\Column(length255)]
  23.     private ?string $domain null;
  24.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  25.     private ?\DateTimeInterface $createDate null;
  26.     #[ORM\OneToMany(mappedBy'whitelabel'targetEntityProduct::class, orphanRemovaltrue)]
  27.     private Collection $products;
  28.     #[ORM\OneToMany(mappedBy'whitelabel'targetEntityComponent::class, orphanRemovaltrue)]
  29.     private Collection $components;
  30.     #[ORM\OneToMany(mappedBy'whitelabel'targetEntityMenu::class)]
  31.     private Collection $menus;
  32.     #[ORM\OneToMany(mappedBy'whitelabel'targetEntityProperty::class)]
  33.     private Collection $properties;
  34.     #[ORM\Column(length255nullabletrue)]
  35.     private ?string $phone null;
  36.     #[ORM\Column(length2000nullabletrue)]
  37.     private ?string $address null;
  38.     #[ORM\OneToMany(mappedBy'whitelabel'targetEntityUser::class, orphanRemovaltrue)]
  39.     private Collection $users;
  40.     #[ORM\OneToMany(mappedBy'whitelabel'targetEntityProductCategory::class)]
  41.     private Collection $productCategories;
  42.     #[ORM\OneToMany(mappedBy'whitelabel'targetEntityAllergen::class)]
  43.     private Collection $allergens;
  44.     #[ORM\OneToMany(mappedBy'whitelabel'targetEntityWhitelabelDomain::class, orphanRemovaltrue)]
  45.     private Collection $whitelabelDomains;
  46.     #[ORM\Column(length255nullabletrue)]
  47.     private ?string $template null;
  48.     #[ORM\Column(length255nullabletrue)]
  49.     private ?string $oneSignalApiId null;
  50.     #[ORM\Column(length255nullabletrue)]
  51.     private ?string $oneSignalApiKey null;
  52.     public function __construct()
  53.     {
  54.         $this->id Uuid::v4();
  55.         $this->products = new ArrayCollection();
  56.         $this->components = new ArrayCollection();
  57.         $this->menus = new ArrayCollection();
  58.         $this->properties = new ArrayCollection();
  59.         $this->users = new ArrayCollection();
  60.         $this->productCategories = new ArrayCollection();
  61.         $this->allergens = new ArrayCollection();
  62.         $this->whitelabelDomains = new ArrayCollection();
  63.     }
  64.     public function getId(): ?string
  65.     {
  66.         return $this->id;
  67.     }
  68.     public function getName(): ?string
  69.     {
  70.         return $this->name;
  71.     }
  72.     public function setName(string $name): self
  73.     {
  74.         $this->name $name;
  75.         return $this;
  76.     }
  77.     public function getDomain(): ?string
  78.     {
  79.         return $this->domain;
  80.     }
  81.     public function setDomain(string $domain): self
  82.     {
  83.         $this->domain $domain;
  84.         return $this;
  85.     }
  86.     public function getCreateDate(): ?\DateTimeInterface
  87.     {
  88.         return $this->createDate;
  89.     }
  90.     public function setCreateDate(\DateTimeInterface $createDate): self
  91.     {
  92.         $this->createDate $createDate;
  93.         return $this;
  94.     }
  95.     /**
  96.      * @return Collection<int, Product>
  97.      */
  98.     public function getProducts(): Collection
  99.     {
  100.         return $this->products;
  101.     }
  102.     public function addProduct(Product $product): self
  103.     {
  104.         if (!$this->products->contains($product)) {
  105.             $this->products->add($product);
  106.             $product->setWhitelabel($this);
  107.         }
  108.         return $this;
  109.     }
  110.     public function removeProduct(Product $product): self
  111.     {
  112.         if ($this->products->removeElement($product)) {
  113.             // set the owning side to null (unless already changed)
  114.             if ($product->getWhitelabel() === $this) {
  115.                 $product->setWhitelabel(null);
  116.             }
  117.         }
  118.         return $this;
  119.     }
  120.     /**
  121.      * @return Collection<int, Component>
  122.      */
  123.     public function getComponents(): Collection
  124.     {
  125.         return $this->components;
  126.     }
  127.     public function addComponent(Component $component): self
  128.     {
  129.         if (!$this->components->contains($component)) {
  130.             $this->components->add($component);
  131.             $component->setWhitelabel($this);
  132.         }
  133.         return $this;
  134.     }
  135.     public function removeComponent(Component $component): self
  136.     {
  137.         if ($this->components->removeElement($component)) {
  138.             // set the owning side to null (unless already changed)
  139.             if ($component->getWhitelabel() === $this) {
  140.                 $component->setWhitelabel(null);
  141.             }
  142.         }
  143.         return $this;
  144.     }
  145.     /**
  146.      * @return Collection<int, Menu>
  147.      */
  148.     public function getMenus(): Collection
  149.     {
  150.         return $this->menus;
  151.     }
  152.     public function addMenu(Menu $menu): self
  153.     {
  154.         if (!$this->menus->contains($menu)) {
  155.             $this->menus->add($menu);
  156.             $menu->setWhitelabel($this);
  157.         }
  158.         return $this;
  159.     }
  160.     public function removeMenu(Menu $menu): self
  161.     {
  162.         if ($this->menus->removeElement($menu)) {
  163.             // set the owning side to null (unless already changed)
  164.             if ($menu->getWhitelabel() === $this) {
  165.                 $menu->setWhitelabel(null);
  166.             }
  167.         }
  168.         return $this;
  169.     }
  170.     /**
  171.      * @return Collection<int, Property>
  172.      */
  173.     public function getProperties(): Collection
  174.     {
  175.         return $this->properties;
  176.     }
  177.     public function addProperty(Property $property): self
  178.     {
  179.         if (!$this->properties->contains($property)) {
  180.             $this->properties->add($property);
  181.             $property->setWhitelabel($this);
  182.         }
  183.         return $this;
  184.     }
  185.     public function removeProperty(Property $property): self
  186.     {
  187.         if ($this->properties->removeElement($property)) {
  188.             // set the owning side to null (unless already changed)
  189.             if ($property->getWhitelabel() === $this) {
  190.                 $property->setWhitelabel(null);
  191.             }
  192.         }
  193.         return $this;
  194.     }
  195.     public function getPhone(): ?string
  196.     {
  197.         return $this->phone;
  198.     }
  199.     public function setPhone(?string $phone): self
  200.     {
  201.         $this->phone $phone;
  202.         return $this;
  203.     }
  204.     public function getAddress(): ?string
  205.     {
  206.         return $this->address;
  207.     }
  208.     public function setAddress(?string $address): self
  209.     {
  210.         $this->address $address;
  211.         return $this;
  212.     }
  213.     /**
  214.      * @return Collection<int, User>
  215.      */
  216.     public function getUsers(): Collection
  217.     {
  218.         return $this->users;
  219.     }
  220.     public function addUser(User $user): self
  221.     {
  222.         if (!$this->users->contains($user)) {
  223.             $this->users->add($user);
  224.             $user->setWhitelabel($this);
  225.         }
  226.         return $this;
  227.     }
  228.     public function removeUser(User $user): self
  229.     {
  230.         if ($this->users->removeElement($user)) {
  231.             // set the owning side to null (unless already changed)
  232.             if ($user->getWhitelabel() === $this) {
  233.                 $user->setWhitelabel(null);
  234.             }
  235.         }
  236.         return $this;
  237.     }
  238.     /**
  239.      * @return Collection<int, ProductCategory>
  240.      */
  241.     public function getProductCategories(): Collection
  242.     {
  243.         return $this->productCategories;
  244.     }
  245.     public function addProductCategory(ProductCategory $productCategory): self
  246.     {
  247.         if (!$this->productCategories->contains($productCategory)) {
  248.             $this->productCategories->add($productCategory);
  249.             $productCategory->setWhitelabel($this);
  250.         }
  251.         return $this;
  252.     }
  253.     public function removeProductCategory(ProductCategory $productCategory): self
  254.     {
  255.         if ($this->productCategories->removeElement($productCategory)) {
  256.             // set the owning side to null (unless already changed)
  257.             if ($productCategory->getWhitelabel() === $this) {
  258.                 $productCategory->setWhitelabel(null);
  259.             }
  260.         }
  261.         return $this;
  262.     }
  263.     /**
  264.      * @return Collection<int, Allergen>
  265.      */
  266.     public function getAllergens(): Collection
  267.     {
  268.         return $this->allergens;
  269.     }
  270.     public function addAllergen(Allergen $allergen): self
  271.     {
  272.         if (!$this->allergens->contains($allergen)) {
  273.             $this->allergens->add($allergen);
  274.             $allergen->setWhitelabel($this);
  275.         }
  276.         return $this;
  277.     }
  278.     public function removeAllergen(Allergen $allergen): self
  279.     {
  280.         if ($this->allergens->removeElement($allergen)) {
  281.             // set the owning side to null (unless already changed)
  282.             if ($allergen->getWhitelabel() === $this) {
  283.                 $allergen->setWhitelabel(null);
  284.             }
  285.         }
  286.         return $this;
  287.     }
  288.     /**
  289.      * @return Collection<int, WhitelabelDomain>
  290.      */
  291.     public function getWhitelabelDomains(): Collection
  292.     {
  293.         return $this->whitelabelDomains;
  294.     }
  295.     public function addWhitelabelDomain(WhitelabelDomain $whitelabelDomain): static
  296.     {
  297.         if (!$this->whitelabelDomains->contains($whitelabelDomain)) {
  298.             $this->whitelabelDomains->add($whitelabelDomain);
  299.             $whitelabelDomain->setWhitelabel($this);
  300.         }
  301.         return $this;
  302.     }
  303.     public function removeWhitelabelDomain(WhitelabelDomain $whitelabelDomain): static
  304.     {
  305.         if ($this->whitelabelDomains->removeElement($whitelabelDomain)) {
  306.             // set the owning side to null (unless already changed)
  307.             if ($whitelabelDomain->getWhitelabel() === $this) {
  308.                 $whitelabelDomain->setWhitelabel(null);
  309.             }
  310.         }
  311.         return $this;
  312.     }
  313.     public function getTemplate(): ?string
  314.     {
  315.         return $this->template;
  316.     }
  317.     public function setTemplate(?string $template): static
  318.     {
  319.         $this->template $template;
  320.         return $this;
  321.     }
  322.     public function getOneSignalApiId(): ?string
  323.     {
  324.         return $this->oneSignalApiId;
  325.     }
  326.     public function setOneSignalApiId(?string $oneSignalApiId): static
  327.     {
  328.         $this->oneSignalApiId $oneSignalApiId;
  329.         return $this;
  330.     }
  331.     public function getOneSignalApiKey(): ?string
  332.     {
  333.         return $this->oneSignalApiKey;
  334.     }
  335.     public function setOneSignalApiKey(?string $oneSignalApiKey): static
  336.     {
  337.         $this->oneSignalApiKey $oneSignalApiKey;
  338.         return $this;
  339.     }
  340. }