src/Entity/Slave/OperationKeyMapping.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Slave;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="eposm_s_operation_key_mapping")
  9.  * @ORM\Entity(repositoryClass="App\Repository\Slave\OperationKeyMappingRepository")
  10.  */
  11. class OperationKeyMapping
  12. {
  13.     public function __toString()
  14.                                                                                                                                                                                                                                                                                                                    {
  15.                                                                                                                                                                                                                                                                                                                        return $this->mappingValue;
  16.                                                                                                                                                                                                                                                                                                                    }
  17.     
  18.     public function displayMappingExtraValue($slug)
  19.     {
  20.         if($this->getMappingExtra() != null){
  21.             $json json_decode($this->getMappingExtra(), true);
  22.             if(array_key_exists($slug$json))
  23.                 return $json[$slug];
  24.             return false;
  25.         }
  26.         return false;
  27.     }
  28.     /**
  29.      * @ORM\Column(name="id", type="bigint")
  30.      * @ORM\Id
  31.      * @ORM\GeneratedValue(strategy="AUTO")
  32.      */
  33.     protected $id;
  34.     /**
  35.      * @ORM\Column(name="ticket_column", type="string", length=191)
  36.      */
  37.     protected $ticketColumn;
  38.     
  39.     /**
  40.      * @ORM\Column(name="mapping_value", type="string", length=191, nullable=true)
  41.      */
  42.     protected $mappingValue;
  43.     
  44.     /**
  45.      * @ORM\Column(name="mapping_extra", type="text", nullable=true)
  46.      */
  47.     protected $mappingExtra;
  48.     
  49.     /**
  50.      * @ORM\Column(name="priority", type="integer")
  51.      */
  52.     protected $priority;
  53.     
  54.     /**
  55.      * @ORM\Column(name="is_key_required", type="boolean")
  56.      */
  57.     protected $keyRequired;
  58.     
  59.     /**
  60.      * @ORM\Column(name="is_ticket_number", type="boolean")
  61.      */
  62.     protected $ticketNumber;
  63.     
  64.     /**
  65.      * @ORM\Column(name="is_termid", type="boolean")
  66.      */
  67.     protected $termid;
  68.     
  69.     // ManyToOne
  70.         /**
  71.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\Operation", inversedBy="keyMappings")
  72.          * @ORM\JoinColumn(name="operation_id", referencedColumnName="id")
  73.          */
  74.         private $operation;
  75.     //
  76.     
  77.     // OneToMany
  78.         /**
  79.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\TicketTag", mappedBy="operationKeyMapping")
  80.          */
  81.         private $ticketTags;
  82.     //
  83.     public function __construct()
  84.     {
  85.         $this->ticketTags = new ArrayCollection();
  86.     }
  87.     public function getId(): ?string
  88.     {
  89.         return $this->id;
  90.     }
  91.     public function getTicketColumn(): ?string
  92.     {
  93.         return $this->ticketColumn;
  94.     }
  95.     public function setTicketColumn(string $ticketColumn): static
  96.     {
  97.         $this->ticketColumn $ticketColumn;
  98.         return $this;
  99.     }
  100.     public function getMappingValue(): ?string
  101.     {
  102.         return $this->mappingValue;
  103.     }
  104.     public function setMappingValue(?string $mappingValue): static
  105.     {
  106.         $this->mappingValue $mappingValue;
  107.         return $this;
  108.     }
  109.     public function getMappingExtra(): ?string
  110.     {
  111.         return $this->mappingExtra;
  112.     }
  113.     public function setMappingExtra(?string $mappingExtra): static
  114.     {
  115.         $this->mappingExtra $mappingExtra;
  116.         return $this;
  117.     }
  118.     public function getPriority(): ?int
  119.     {
  120.         return $this->priority;
  121.     }
  122.     public function setPriority(int $priority): static
  123.     {
  124.         $this->priority $priority;
  125.         return $this;
  126.     }
  127.     public function isKeyRequired(): ?bool
  128.     {
  129.         return $this->keyRequired;
  130.     }
  131.     public function setKeyRequired(bool $keyRequired): static
  132.     {
  133.         $this->keyRequired $keyRequired;
  134.         return $this;
  135.     }
  136.     public function isTicketNumber(): ?bool
  137.     {
  138.         return $this->ticketNumber;
  139.     }
  140.     public function setTicketNumber(bool $ticketNumber): static
  141.     {
  142.         $this->ticketNumber $ticketNumber;
  143.         return $this;
  144.     }
  145.     public function isTermid(): ?bool
  146.     {
  147.         return $this->termid;
  148.     }
  149.     public function setTermid(bool $termid): static
  150.     {
  151.         $this->termid $termid;
  152.         return $this;
  153.     }
  154.     public function getOperation(): ?Operation
  155.     {
  156.         return $this->operation;
  157.     }
  158.     public function setOperation(?Operation $operation): static
  159.     {
  160.         $this->operation $operation;
  161.         return $this;
  162.     }
  163.     /**
  164.      * @return Collection<int, TicketTag>
  165.      */
  166.     public function getTicketTags(): Collection
  167.     {
  168.         return $this->ticketTags;
  169.     }
  170.     public function addTicketTag(TicketTag $ticketTag): static
  171.     {
  172.         if (!$this->ticketTags->contains($ticketTag)) {
  173.             $this->ticketTags->add($ticketTag);
  174.             $ticketTag->setOperationKeyMapping($this);
  175.         }
  176.         return $this;
  177.     }
  178.     public function removeTicketTag(TicketTag $ticketTag): static
  179.     {
  180.         if ($this->ticketTags->removeElement($ticketTag)) {
  181.             // set the owning side to null (unless already changed)
  182.             if ($ticketTag->getOperationKeyMapping() === $this) {
  183.                 $ticketTag->setOperationKeyMapping(null);
  184.             }
  185.         }
  186.         return $this;
  187.     }
  188. }