src/CmsBundle/Entity/PageTag.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\CmsBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * @ORM\Entity(repositoryClass="App\CmsBundle\Repository\PageTagRepository")
  6.  * @ORM\Table(name="page_tag",
  7.  *     indexes={
  8.  *         @ORM\Index(name="page_idx", columns={"page_id"}),
  9.  *         @ORM\Index(name="page_tag_idx", columns={"tag_id"}),
  10.  *         @ORM\Index(name="page_widget_idx", columns={"widget_id"})
  11.  *     }
  12.  * )
  13.  */
  14. class PageTag
  15. {
  16.     use IdTrait;
  17.     /**
  18.      * @ORM\ManyToOne(targetEntity=Page::class, inversedBy="pageTags")
  19.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  20.      */
  21.     private Page $page;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=Widget::class, inversedBy="pageTags")
  24.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  25.      */
  26.     private ?Widget $widget null;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=Tag::class, inversedBy="pageTags")
  29.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  30.      */
  31.     private Tag $tag;
  32.     /**
  33.      * @ORM\Column(type="float")
  34.      */
  35.     private float $weight;
  36.     /**
  37.      * @return Page
  38.      */
  39.     public function getPage(): Page
  40.     {
  41.         return $this->page;
  42.     }
  43.     /**
  44.      * @param Page $page
  45.      * @return $this
  46.      */
  47.     public function setPage(Page $page): self
  48.     {
  49.         $this->page $page;
  50.         return $this;
  51.     }
  52.     /**
  53.      * @return Tag
  54.      */
  55.     public function getTag(): Tag
  56.     {
  57.         return $this->tag;
  58.     }
  59.     /**
  60.      * @param Tag $tag
  61.      * @return $this
  62.      */
  63.     public function setTag(Tag $tag): self
  64.     {
  65.         $this->tag $tag;
  66.         return $this;
  67.     }
  68.     /**
  69.      * @return float|null
  70.      */
  71.     public function getWeight(): ?float
  72.     {
  73.         return $this->weight;
  74.     }
  75.     /**
  76.      * @param float $weight
  77.      * @return $this
  78.      */
  79.     public function setWeight(float $weight): self
  80.     {
  81.         $this->weight $weight;
  82.         return $this;
  83.     }
  84.     /**
  85.      * @return ?Widget
  86.      */
  87.     public function getWidget(): ?Widget
  88.     {
  89.         return $this->widget;
  90.     }
  91.     /**
  92.      * @param ?Widget $widget
  93.      * @return $this
  94.      */
  95.     public function setWidget(?Widget $widget): self
  96.     {
  97.         $this->widget $widget;
  98.         return $this;
  99.     }
  100. }