src/Entity/Application.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\ApplicationRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ApiResource]
  9. #[ORM\Entity(repositoryClassApplicationRepository::class)]
  10. class Application
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     private $id;
  16.     #[ORM\Column(type'string'length255)]
  17.     private ?string $name null;
  18.     #[ORM\Column(type'integer')]
  19.     private ?int $menuOrder null;
  20.     #[ORM\Column(type'boolean'nullabletrue)]
  21.     private ?bool $isEnabled null;
  22.     #[ORM\Column(length255nullabletrue)]
  23.     private ?string $image null;
  24.     #[ORM\Column(nullabletrue)]
  25.     private ?float $price null;
  26.     #[ORM\Column(nullabletrue)]
  27.     private ?array $jsonContent null;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $pageUrl null;
  30.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'subApplications')]
  31.     private ?self $parentApplication null;
  32.     #[ORM\OneToMany(mappedBy'parentApplication'targetEntityself::class)]
  33.     private Collection $subApplications;
  34.     public function __construct()
  35.     {
  36.         $this->subApplications = new ArrayCollection();
  37.     }
  38.     public function __toString()
  39.     {
  40.         return (string)$this->name;
  41.     }
  42.     public function getId(): ?int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getName(): ?string
  47.     {
  48.         return $this->name;
  49.     }
  50.     public function setName(string $name): self
  51.     {
  52.         $this->name $name;
  53.         return $this;
  54.     }
  55.     public function getMenuOrder(): ?int
  56.     {
  57.         return $this->menuOrder;
  58.     }
  59.     public function setMenuOrder(int $menuOrder): self
  60.     {
  61.         $this->menuOrder $menuOrder;
  62.         return $this;
  63.     }
  64.     public function getIsEnabled(): ?bool
  65.     {
  66.         return $this->isEnabled;
  67.     }
  68.     public function setIsEnabled(?bool $isEnabled): self
  69.     {
  70.         $this->isEnabled $isEnabled;
  71.         return $this;
  72.     }
  73.     public function getImage(): ?string
  74.     {
  75.         return $this->image;
  76.     }
  77.     public function setImage(?string $image): static
  78.     {
  79.         $this->image $image;
  80.         return $this;
  81.     }
  82.     public function getPrice(): ?float
  83.     {
  84.         return $this->price;
  85.     }
  86.     public function setPrice(?float $price): static
  87.     {
  88.         $this->price $price;
  89.         return $this;
  90.     }
  91.     public function getJsonContent(): ?array
  92.     {
  93.         return $this->jsonContent;
  94.     }
  95.     public function setJsonContent(?array $jsonContent): static
  96.     {
  97.         $this->jsonContent $jsonContent;
  98.         return $this;
  99.     }
  100.     public function getPageUrl(): ?string
  101.     {
  102.         return $this->pageUrl;
  103.     }
  104.     public function setPageUrl(?string $pageUrl): static
  105.     {
  106.         $this->pageUrl $pageUrl;
  107.         return $this;
  108.     }
  109.     public function getParentApplication(): ?self
  110.     {
  111.         return $this->parentApplication;
  112.     }
  113.     public function setParentApplication(?self $parentApplication): static
  114.     {
  115.         $this->parentApplication $parentApplication;
  116.         return $this;
  117.     }
  118.     /**
  119.      * @return Collection<int, self>
  120.      */
  121.     public function getSubApplications(): Collection
  122.     {
  123.         return $this->subApplications;
  124.     }
  125.     public function addSubApplication(self $subApplication): static
  126.     {
  127.         if (!$this->subApplications->contains($subApplication)) {
  128.             $this->subApplications->add($subApplication);
  129.             $subApplication->setParentApplication($this);
  130.         }
  131.         return $this;
  132.     }
  133.     public function removeSubApplication(self $subApplication): static
  134.     {
  135.         if ($this->subApplications->removeElement($subApplication)) {
  136.             // set the owning side to null (unless already changed)
  137.             if ($subApplication->getParentApplication() === $this) {
  138.                 $subApplication->setParentApplication(null);
  139.             }
  140.         }
  141.         return $this;
  142.     }
  143. }