<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* @ORM\Entity (repositoryClass="App\Repository\WebPageBlockGroupRepository")
*/
#[ApiResource(order: ['ordering'])]
class WebPageBlockGroup
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $label;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $CSSClass;
/**
* @ORM\Column(type="json", nullable=true, options={"comment":"Largeur du groupe (type 1-3 1-2@m 1-1@s)"})
*/
private $width;
/**
* @ORM\Column(type="json", nullable=true)
*/
private $labelTranslations;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $groupIcon;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\WebPageBlock", mappedBy="wpGroup", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"ordering" = "ASC"})
*/
private $blocks;
/**
* @ORM\Column(type="json", nullable=true, options={"comment":"Options de visibilité"})
*/
private $visibilityOptions;
public function __construct()
{
$this->blocks = new ArrayCollection();
}
public function getId() : ?int
{
return $this->id;
}
public function getWidth() : ?array
{
return $this->width;
}
public function setWidth(?array $width) : self
{
$this->width = $width;
return $this;
}
public function getCSSClass() : ?string
{
return $this->CSSClass;
}
public function setCSSClass(?string $CSSClass) : self
{
$this->CSSClass = $CSSClass;
return $this;
}
public function getLabel() : ?string
{
return $this->label;
}
public function setLabel(?string $label) : self
{
$this->label = $label;
return $this;
}
public function getLabelTranslations() : ?array
{
return $this->labelTranslations;
}
public function setLabelTranslations(?array $labelTranslations) : self
{
$this->labelTranslations = $labelTranslations;
return $this;
}
public function getGroupIcon() : ?string
{
return $this->groupIcon;
}
public function setGroupIcon(?string $groupIcon) : self
{
$this->groupIcon = $groupIcon;
return $this;
}
/**
* @return Collection|WebPageBlock[]
*/
public function getBlocks() : Collection
{
return $this->blocks;
}
public function addBlock(WebPageBlock $block) : self
{
if (!$this->blocks->contains($block)) {
$this->blocks[] = $block;
$block->setBlockField($this);
}
return $this;
}
public function removeBlock(WebPageBlock $block) : self
{
if ($this->blocks->contains($block)) {
$this->blocks->removeElement($block);
if ($block->getBlockField() === $this) {
$block->setBlockField(null);
}
}
return $this;
}
public function getVisibilityOptions() : ?array
{
return $this->visibilityOptions;
}
public function setVisibilityOptions(?array $visibilityOptions) : self
{
$this->visibilityOptions = $visibilityOptions;
return $this;
}
}