src/Entity/BridgeComponentTag.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BridgeComponentTagRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity (repositoryClass=BridgeComponentTagRepository::class)
  9.  */
  10. class BridgeComponentTag
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255, unique=true, nullable=true)
  20.      */
  21.     private $textkey;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $name;
  26.     /**
  27.      * @ORM\ManyToMany(targetEntity=BridgeComponent::class, mappedBy="tags")
  28.      */
  29.     private $bridgeComponents;
  30.     public function __construct()
  31.     {
  32.         $this->bridgeComponents = new ArrayCollection();
  33.     }
  34.     public function getId() : ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getName() : string
  39.     {
  40.         return $this->name;
  41.     }
  42.     public function setName(string $name) : self
  43.     {
  44.         $this->name $name;
  45.         return $this;
  46.     }
  47.     public function getTextkey() : ?string
  48.     {
  49.         return $this->textkey;
  50.     }
  51.     public function setTextkey(?string $textkey) : self
  52.     {
  53.         $this->textkey $textkey;
  54.         return $this;
  55.     }
  56.     /**
  57.      * @return Collection|BridgeComponent[]
  58.      */
  59.     public function getBridgeComponents() : Collection
  60.     {
  61.         return $this->bridgeComponents;
  62.     }
  63.     public function addBridgeComponent(BridgeComponent $bridgeComponent) : self
  64.     {
  65.         if (!$this->bridgeComponents->contains($bridgeComponent)) {
  66.             $this->bridgeComponents[] = $bridgeComponent;
  67.             $bridgeComponent->addTag($this);
  68.         }
  69.         return $this;
  70.     }
  71.     public function removeBridgeComponent(BridgeComponent $bridgeComponent) : self
  72.     {
  73.         if ($this->bridgeComponents->removeElement($bridgeComponent)) {
  74.             $bridgeComponent->removeTag($this);
  75.         }
  76.         return $this;
  77.     }
  78.     public function toExport() : array
  79.     {
  80.         $tag = array();
  81.         $tag['textkey'] = $this->getTextkey();
  82.         $tag['name'] = $this->getName();
  83.         return $tag;
  84.     }
  85. }