src/Entity/Application.php line 13
<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\ApplicationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ApiResource]
#[ORM\Entity(repositoryClass: ApplicationRepository::class)]
class Application
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private ?string $name = null;
#[ORM\Column(type: 'integer')]
private ?int $menuOrder = null;
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $isEnabled = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $image = null;
#[ORM\Column(nullable: true)]
private ?float $price = null;
#[ORM\Column(nullable: true)]
private ?array $jsonContent = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $pageUrl = null;
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'subApplications')]
private ?self $parentApplication = null;
#[ORM\OneToMany(mappedBy: 'parentApplication', targetEntity: self::class)]
private Collection $subApplications;
public function __construct()
{
$this->subApplications = new ArrayCollection();
}
public function __toString()
{
return (string)$this->name;
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getMenuOrder(): ?int
{
return $this->menuOrder;
}
public function setMenuOrder(int $menuOrder): self
{
$this->menuOrder = $menuOrder;
return $this;
}
public function getIsEnabled(): ?bool
{
return $this->isEnabled;
}
public function setIsEnabled(?bool $isEnabled): self
{
$this->isEnabled = $isEnabled;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): static
{
$this->image = $image;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(?float $price): static
{
$this->price = $price;
return $this;
}
public function getJsonContent(): ?array
{
return $this->jsonContent;
}
public function setJsonContent(?array $jsonContent): static
{
$this->jsonContent = $jsonContent;
return $this;
}
public function getPageUrl(): ?string
{
return $this->pageUrl;
}
public function setPageUrl(?string $pageUrl): static
{
$this->pageUrl = $pageUrl;
return $this;
}
public function getParentApplication(): ?self
{
return $this->parentApplication;
}
public function setParentApplication(?self $parentApplication): static
{
$this->parentApplication = $parentApplication;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getSubApplications(): Collection
{
return $this->subApplications;
}
public function addSubApplication(self $subApplication): static
{
if (!$this->subApplications->contains($subApplication)) {
$this->subApplications->add($subApplication);
$subApplication->setParentApplication($this);
}
return $this;
}
public function removeSubApplication(self $subApplication): static
{
if ($this->subApplications->removeElement($subApplication)) {
// set the owning side to null (unless already changed)
if ($subApplication->getParentApplication() === $this) {
$subApplication->setParentApplication(null);
}
}
return $this;
}
}