src/Entity/Page/Page.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Page;
  3. use App\Entity\Blog;
  4. use App\Entity\FooterLink;
  5. use App\Entity\Metatag;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  9. use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
  10. use App\Entity\Traits\AutoTranslateTrait;
  11. use App\Entity\Traits\IdTrait;
  12. use App\Entity\Traits\TimeStampAbleTrait;
  13. use App\Repository\PageRepository;
  14. use Doctrine\ORM\Mapping as ORM;
  15. /**
  16.  * @ORM\Entity(repositoryClass=PageRepository::class)
  17.  * @ORM\HasLifecycleCallbacks
  18.  */
  19. class Page implements TranslatableInterface
  20. {
  21.     use IdTrait;
  22.     use TimeStampAbleTrait;
  23.     use TranslatableTrait;
  24.     use AutoTranslateTrait;
  25.     /**
  26.      * @ORM\Column(type="integer", options={"unsigned": true}, nullable=true)
  27.      */
  28.     private int $migrationId;
  29.     /**
  30.      * @ORM\Column(type="string", nullable=true)
  31.      */
  32.     private ?string $templatePath;
  33.     /**
  34.      * @ORM\OneToOne(targetEntity=Blog::class, cascade={"persist", "remove"})
  35.      * @ORM\JoinColumn(nullable=true)
  36.      */
  37.     private $blog;
  38.     /**
  39.      * @ORM\OneToOne(targetEntity=FooterLink::class, mappedBy="page", cascade={"persist", "remove"})
  40.      * @ORM\JoinColumn(nullable=true)
  41.      */
  42.     private $footerLink;
  43.     public function __construct(){}
  44.     /**
  45.      * @return int
  46.      */
  47.     public function getMigrationId(): int
  48.     {
  49.         return $this->migrationId;
  50.     }
  51.     /**
  52.      * @return string|null
  53.      */
  54.     public function getTemplatePath(): ?string
  55.     {
  56.         return $this->templatePath;
  57.     }
  58.     /**
  59.      * @param int $migrationId
  60.      */
  61.     public function setMigrationId(int $migrationId): self
  62.     {
  63.         $this->migrationId = $migrationId;
  64.         return $this;
  65.     }
  66.     /**
  67.      * @param string|null $templatePath
  68.      */
  69.     public function setTemplatePath(?string $templatePath): self
  70.     {
  71.         $this->templatePath = $templatePath;
  72.         return $this;
  73.     }
  74.     /**
  75.      * @return null|Blog
  76.      */
  77.     public function getBlog(): ?Blog
  78.     {
  79.         return $this->blog;
  80.     }
  81.     public function setBlog(?Blog $blog): self
  82.     {
  83.         $this->blog = $blog;
  84.         return $this;
  85.     }
  86.     public function getFooterLink(): ?FooterLink
  87.     {
  88.         return $this->footerLink;
  89.     }
  90.     public function setFooterLink(?FooterLink $footerLink): self
  91.     {
  92.         // unset the owning side of the relation if necessary
  93.         if ($footerLink === null && $this->footerLink !== null) {
  94.             $this->footerLink->setPage(null);
  95.         }
  96.         // set the owning side of the relation if necessary
  97.         if ($footerLink !== null && $footerLink->getPage() !== $this) {
  98.             $footerLink->setPage($this);
  99.         }
  100.         $this->footerLink = $footerLink;
  101.         return $this;
  102.     }
  103. }