<?php
namespace App\Entity;
use App\Repository\ParameterHookRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
use JMS\Serializer\Annotation\Expose;
use JMS\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=ParameterHookRepository::class)
*
* @Serializer\ExclusionPolicy("ALL")
*/
class ParameterHook
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*
* @Expose
* @Groups({"parameter"})
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*
* @Expose
* @Groups({"parameter"})
*/
private $slug;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Expose
* @Groups({"parameter"})
*/
private $name;
/**
* @ORM\OneToMany(targetEntity=Parameter::class, mappedBy="parameterHook")
*/
private $parameters;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $displayJob;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $displayRole;
public function __construct()
{
$this->parameters = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug( string $slug ): self
{
$this->slug = $slug;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName( ?string $name ): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection<int, Parameter>
*/
public function getParameters(): Collection
{
return $this->parameters;
}
public function addParameter( Parameter $parameter ): self
{
if ( !$this->parameters->contains( $parameter ) ) {
$this->parameters[] = $parameter;
$parameter->setParameterHook( $this );
}
return $this;
}
public function removeParameter( Parameter $parameter ): self
{
if ( $this->parameters->removeElement( $parameter ) ) {
// set the owning side to null (unless already changed)
if ( $parameter->getParameterHook() === $this ) {
$parameter->setParameterHook( NULL );
}
}
return $this;
}
public function getDisplayRole(): ?array
{
if ( $this->displayRole === NULL ) {
return $this->displayRole;
}
return explode( ';', $this->displayRole );
}
public function setDisplayRole( ?array $displayRole ): self
{
if ( $displayRole === [] ) {
$this->displayRole = NULL;
}
else {
$this->displayRole = implode( ';', $displayRole );
}
return $this;
}
public function getDisplayJob(): ?array
{
if ( $this->displayJob === NULL ) {
return $this->displayJob;
}
return explode( ';', $this->displayJob );
}
public function setDisplayJob( ?array $displayJob ): self
{
if ( $displayJob === [] ) {
$this->displayJob = NULL;
}
else {
$this->displayJob = implode( ';', $displayJob );
}
return $this;
}
}