<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity (repositoryClass="App\Repository\BridgeParameterRepository")
*/
class BridgeParameter
{
/**
* @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, unique=true)
*/
private $key;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $defaultValue;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $ordering;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $helpText;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\BridgeParameterGroup", inversedBy="parameters")
*/
private $parameterGroup;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $type;
/**
* @ORM\Column(type="json", nullable=true)
*/
private $options = [];
/**
* @ORM\Column(type="json", nullable=true)
*/
private $value = [];
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="bridgeParameters")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="owner_id", referencedColumnName="id")
* })
*/
// private $owner;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\DnsitEntity", inversedBy="bridgeParameters")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="entity_id", referencedColumnName="id")
* })
*/
// private $entity;
/**
* @ORM\OneToMany(targetEntity=WebListParameter::class, mappedBy="bridgeParameter", orphanRemoval=true)
*/
private $webListParameters;
/**
* @ORM\OneToMany(targetEntity=WebSiteParameter::class, mappedBy="bridgeParameter", orphanRemoval=true)
*/
private $webSiteParameters;
/**
* @ORM\OneToMany(targetEntity=WebPageParameter::class, mappedBy="bridgeParameter", orphanRemoval=true)
*/
private $webPageParameters;
/**
* @ORM\OneToMany(targetEntity=BridgeUserParameter::class, mappedBy="parameter", orphanRemoval=true)
*/
private $userParameters;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default":false})
*/
private ?bool $usableByEntitiesAdmins = false;
public function __construct()
{
$this->webSiteParameters = new ArrayCollection();
$this->webListParameters = new ArrayCollection();
$this->webPageParameters = new ArrayCollection();
$this->userParameters = new ArrayCollection();
}
public function getId() : ?int
{
return $this->id;
}
public function getLabel() : ?string
{
return $this->label;
}
public function setLabel(?string $label) : self
{
$this->label = $label;
return $this;
}
public function getKey() : ?string
{
return $this->key;
}
public function setKey(?string $key) : self
{
$this->key = $key;
return $this;
}
public function getUsableByEntitiesAdmins(): ?bool
{
return $this->usableByEntitiesAdmins;
}
public function setUsableByEntitiesAdmins(?bool $usableByEntitiesAdmins): self
{
$this->usableByEntitiesAdmins = $usableByEntitiesAdmins;
return $this;
}
public function getDefaultValue() : ?string
{
return $this->defaultValue;
}
public function setDefaultValue(?string $defaultValue) : self
{
$this->defaultValue = $defaultValue;
return $this;
}
public function getOrdering() : ?int
{
return $this->ordering;
}
public function setOrdering(?int $ordering) : self
{
$this->ordering = $ordering;
return $this;
}
public function getHelpText() : ?string
{
return $this->helpText;
}
public function setHelpText(?string $helpText) : self
{
$this->helpText = $helpText;
return $this;
}
public function getParameterGroup() : ?BridgeParameterGroup
{
return $this->parameterGroup;
}
public function setParameterGroup(?BridgeParameterGroup $parameterGroup) : self
{
$this->parameterGroup = $parameterGroup;
return $this;
}
public function getType() : ?string
{
return $this->type;
}
public function setType(?string $type) : self
{
$this->type = $type;
return $this;
}
public function getOptions() : ?array
{
return $this->options;
}
public function setOptions(?array $options) : self
{
$this->options = $options;
return $this;
}
public function getValue() : ?array
{
return $this->value;
}
public function setValue(?array $value) : self
{
$this->value = $value;
return $this;
}
/**
* @return Collection|WebListParameter[]
*/
public function getWebListParameters() : Collection
{
return $this->webListParameters;
}
public function addWebListParameter(WebListParameter $webListParameter) : self
{
if (!$this->webListParameters->contains($webListParameter)) {
$this->webListParameters[] = $webListParameter;
$webListParameter->setBridgeParameter($this);
}
return $this;
}
public function removeWebListParameter(WebListParameter $webListParameter) : self
{
if ($this->webListParameters->removeElement($webListParameter)) {
// set the owning side to null (unless already changed)
if ($webListParameter->getBridgeParameter() === $this) {
$webListParameter->setBridgeParameter(null);
}
}
return $this;
}
/**
* @return Collection|BridgeUserParameter[]
*/
public function getUserParameters() : Collection
{
return $this->userParameters;
}
public function addUserParameter(BridgeUserParameter $userParameter) : self
{
if (!$this->userParameters->contains($userParameter)) {
$this->userParameters[] = $userParameter;
$userParameter->setParameter($this);
}
return $this;
}
public function removeUserParameter(BridgeUserParameter $userParameter) : self
{
if ($this->userParameters->removeElement($userParameter)) {
// set the owning side to null (unless already changed)
if ($userParameter->getParameter() === $this) {
$userParameter->setParameter(null);
}
}
return $this;
}
/**
* @return Collection|WebListParameter[]
*/
public function getWebSiteParameters() : Collection
{
return $this->webSiteParameters;
}
public function addWebSiteParameter(WebSiteParameter $webSiteParameter) : self
{
if (!$this->webSiteParameters->contains($webSiteParameter)) {
$this->webSiteParameters[] = $webSiteParameter;
$webSiteParameter->setBridgeParameter($this);
}
return $this;
}
public function removeWebSiteParameter(WebSiteParameter $webSiteParameter) : self
{
if ($this->webSiteParameters->removeElement($webSiteParameter)) {
// set the owning side to null (unless already changed)
if ($webSiteParameter->getBridgeParameter() === $this) {
$webSiteParameter->setBridgeParameter(null);
}
}
return $this;
}
/**
* @return Collection|WebPageParameter[]
*/
public function getWebPageParameters() : Collection
{
return $this->webPageParameters;
}
public function addWebPageParameter(WebPageParameter $webPageParameter) : self
{
if (!$this->webPageParameters->contains($webPageParameter)) {
$this->webPageParameters[] = $webPageParameter;
$webPageParameter->setBridgeParameter($this);
}
return $this;
}
public function removeWebPageParameter(WebPageParameter $webPageParameter) : self
{
if ($this->webPageParameters->removeElement($webPageParameter)) {
// set the owning side to null (unless already changed)
if ($webPageParameter->getBridgeParameter() === $this) {
$webPageParameter->setBridgeParameter(null);
}
}
return $this;
}
public function getForWeb()
{
return ['id' => $this->getId(), 'key' => $this->getKey(), 'label' => $this->getLabel(), 'ordering' => $this->getOrdering(), 'value' => $this->getValue()];
}
/*
public function getOwner(): ?User
{
return $this->owner;
}
public function setOwner(?User $owner): self
{
$this->owner = $owner;
return $this;
}
public function getEntity(): ?DnsitEntity
{
return $this->entity;
}
public function setEntity(?DnsitEntity $entity): self
{
$this->entity = $entity;
return $this;
}
*/
}