src/Entity/Node.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\NodeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassNodeRepository::class)]
  9. #[ORM\InheritanceType("SINGLE_TABLE")]
  10. #[ORM\DiscriminatorMap(["DISCOUNT" => "App\Entity\Discount""BUSINESS" => "App\Entity\Business""NEWS" => "App\Entity\News""PAGE" => "App\Entity\Page"])]
  11. class Node
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\Column(type"integer")]
  15.     #[ORM\GeneratedValue(strategy"AUTO")]
  16.     private ?int $id null;
  17.     #[ORM\Column(type"string"length255nullablefalse)]
  18.     protected ?string $title null;
  19.     #[ORM\Column(type"text"nullabletrue)]
  20.     private ?string $description null;
  21.     #[ORM\Column(type"boolean"nullablefalse)]
  22.     private bool $published;
  23.     #[ORM\OneToMany(targetEntity\App\Entity\Node::class, mappedBy"parent")]
  24.     private Collection $nodes;
  25.     #[ORM\ManyToOne(targetEntity\App\Entity\Node::class, inversedBy"nodes")]
  26.     #[ORM\JoinColumn(name"parent"referencedColumnName"id")]
  27.     protected ?Node $parent null;
  28.     #[ORM\Column(length255)]
  29.     private ?string $url null;
  30.     #[ORM\OneToMany(mappedBy'node'targetEntityOpeningHours::class, cascade: ['persist'])]
  31.     private Collection $openingHours;
  32.     #[ORM\ManyToMany(targetEntityTag::class, inversedBy'nodes'cascade: ['persist'])]
  33.     protected Collection $tags;
  34.     public function __construct()
  35.     {
  36.         $this->openingHours = new ArrayCollection();
  37.         $this->tags = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getTitle(): ?string
  44.     {
  45.         return $this->title;
  46.     }
  47.     public function setTitle(string $title): static
  48.     {
  49.         $this->title $title;
  50.         return $this;
  51.     }
  52.     public function getDescription(): ?string
  53.     {
  54.         return $this->description;
  55.     }
  56.     public function setDescription(?string $description): static
  57.     {
  58.         $this->description $description;
  59.         return $this;
  60.     }
  61.     public function isPublished(): ?bool
  62.     {
  63.         return $this->published;
  64.     }
  65.     public function setPublished(bool $published): static
  66.     {
  67.         $this->published $published;
  68.         return $this;
  69.     }
  70.     public function getNodes()
  71.     {
  72.         return $this->nodes;
  73.     }
  74.     public function setNodes($nodes): void
  75.     {
  76.         $this->nodes $nodes;
  77.     }
  78.     /**
  79.      * @return mixed
  80.      */
  81.     public function getParent()
  82.     {
  83.         return $this->parent;
  84.     }
  85.     /**
  86.      * @param mixed $parent
  87.      */
  88.     public function setParent($parent): void
  89.     {
  90.         $this->parent $parent;
  91.     }
  92.     public function getUrl(): ?string
  93.     {
  94.         return $this->url;
  95.     }
  96.     public function setUrl(string $url): static
  97.     {
  98.         $this->url $url;
  99.         return $this;
  100.     }
  101.     /**
  102.      * @return Collection<int, OpeningHours>
  103.      */
  104.     public function getOpeningHours(): Collection
  105.     {
  106.         return $this->openingHours;
  107.     }
  108.     public function addOpeningHour(OpeningHours $openingHour): static
  109.     {
  110.         if (!$this->openingHours->contains($openingHour)) {
  111.             $this->openingHours->add($openingHour);
  112.             $openingHour->setNode($this);
  113.         }
  114.         return $this;
  115.     }
  116.     public function removeOpeningHour(OpeningHours $openingHour): static
  117.     {
  118.         if ($this->openingHours->contains($openingHour)) {
  119.             $this->openingHours->remove($openingHour);
  120.         }
  121.         return $this;
  122.     }
  123.     /**
  124.      * @return Collection<int, Tag>
  125.      */
  126.     public function getTags(): Collection
  127.     {
  128.         return $this->tags;
  129.     }
  130.     public function addTag(Tag $tag): static
  131.     {
  132.         if (!$this->tags->contains($tag)) {
  133.             $this->tags->add($tag);
  134.         }
  135.         return $this;
  136.     }
  137.     public function removeTag(Tag $tag): static
  138.     {
  139.         $this->tags->removeElement($tag);
  140.         return $this;
  141.     }
  142. }