<?php
namespace App\CmsBundle\Entity;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* WidgetCategory
*
* @ORM\Table(name="widget_category")
* @ORM\Entity(repositoryClass="App\CmsBundle\Repository\WidgetCategoryRepository")
*/
class WidgetCategory
{
use IdTrait;
/**
* @ORM\Column(name="name", type="string", nullable=false)
*/
private string $title;
/**
* @ORM\ManyToMany(targetEntity=Widget::class, mappedBy="categories")
*/
private Collection $widgets;
public function __construct()
{
$this->widgets = new ArrayCollection();
}
/**
* @return string
*/
public function __toString(): string
{
return $this->title ?? '';
}
/**
* @return string
*/
public function getTitle(): string
{
return $this->title;
}
public function getWidgets(): Collection
{
return $this->widgets;
}
/**
* @param string $title
* @return WidgetCategory
*/
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
}