<?php
namespace App\Entity;
use App\Repository\BridgeComponentTagRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity (repositoryClass=BridgeComponentTagRepository::class)
*/
class BridgeComponentTag
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, unique=true, nullable=true)
*/
private $textkey;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\ManyToMany(targetEntity=BridgeComponent::class, mappedBy="tags")
*/
private $bridgeComponents;
public function __construct()
{
$this->bridgeComponents = new ArrayCollection();
}
public function getId() : ?int
{
return $this->id;
}
public function getName() : string
{
return $this->name;
}
public function setName(string $name) : self
{
$this->name = $name;
return $this;
}
public function getTextkey() : ?string
{
return $this->textkey;
}
public function setTextkey(?string $textkey) : self
{
$this->textkey = $textkey;
return $this;
}
/**
* @return Collection|BridgeComponent[]
*/
public function getBridgeComponents() : Collection
{
return $this->bridgeComponents;
}
public function addBridgeComponent(BridgeComponent $bridgeComponent) : self
{
if (!$this->bridgeComponents->contains($bridgeComponent)) {
$this->bridgeComponents[] = $bridgeComponent;
$bridgeComponent->addTag($this);
}
return $this;
}
public function removeBridgeComponent(BridgeComponent $bridgeComponent) : self
{
if ($this->bridgeComponents->removeElement($bridgeComponent)) {
$bridgeComponent->removeTag($this);
}
return $this;
}
public function toExport() : array
{
$tag = array();
$tag['textkey'] = $this->getTextkey();
$tag['name'] = $this->getName();
return $tag;
}
}