<?php
namespace App\CmsBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\CmsBundle\Repository\PageTagRepository")
* @ORM\Table(name="page_tag",
* indexes={
* @ORM\Index(name="page_idx", columns={"page_id"}),
* @ORM\Index(name="page_tag_idx", columns={"tag_id"}),
* @ORM\Index(name="page_widget_idx", columns={"widget_id"})
* }
* )
*/
class PageTag
{
use IdTrait;
/**
* @ORM\ManyToOne(targetEntity=Page::class, inversedBy="pageTags")
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
*/
private Page $page;
/**
* @ORM\ManyToOne(targetEntity=Widget::class, inversedBy="pageTags")
* @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
*/
private ?Widget $widget = null;
/**
* @ORM\ManyToOne(targetEntity=Tag::class, inversedBy="pageTags")
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
*/
private Tag $tag;
/**
* @ORM\Column(type="float")
*/
private float $weight;
/**
* @return Page
*/
public function getPage(): Page
{
return $this->page;
}
/**
* @param Page $page
* @return $this
*/
public function setPage(Page $page): self
{
$this->page = $page;
return $this;
}
/**
* @return Tag
*/
public function getTag(): Tag
{
return $this->tag;
}
/**
* @param Tag $tag
* @return $this
*/
public function setTag(Tag $tag): self
{
$this->tag = $tag;
return $this;
}
/**
* @return float|null
*/
public function getWeight(): ?float
{
return $this->weight;
}
/**
* @param float $weight
* @return $this
*/
public function setWeight(float $weight): self
{
$this->weight = $weight;
return $this;
}
/**
* @return ?Widget
*/
public function getWidget(): ?Widget
{
return $this->widget;
}
/**
* @param ?Widget $widget
* @return $this
*/
public function setWidget(?Widget $widget): self
{
$this->widget = $widget;
return $this;
}
}