src/Entity/Slave/TicketTag.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_ticket_tag")
  9.  * @ORM\Entity(repositoryClass="App\Repository\Slave\TicketTagRepository")
  10.  */
  11. class TicketTag
  12. {      
  13.     public function getCanDelete(){
  14.         if(count($this->tickets) > 0) return false;
  15.         return true;
  16.     }
  17.      
  18.     /**
  19.      * @ORM\Column(name="id", type="bigint")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     protected $id;
  24.     
  25.     /**
  26.      * @ORM\Column(name="name", type="string", length=191)
  27.      */
  28.     protected $name;
  29.     
  30.     /**
  31.      * @ORM\Column(name="mapping_value", type="string", length=191)
  32.      */
  33.     protected $mappingValue;
  34.     
  35.     /**
  36.      * @ORM\Column(name="color", type="string", length=191)
  37.      */
  38.     protected $color;
  39.     
  40.     /**
  41.      * @ORM\Column(name="datetime_start", type="datetime", nullable=true)
  42.      */
  43.     protected $datetimeStart;
  44.     
  45.     /**
  46.      * @ORM\Column(name="datetime_end", type="datetime", nullable=true)
  47.      */
  48.     protected $datetimeEnd;
  49.     // ManyToOne
  50.         /**
  51.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\OperationKeyMapping", inversedBy="ticketTags")
  52.          * @ORM\JoinColumn(name="operation_key_mapping_id", referencedColumnName="id")
  53.          */
  54.         private $operationKeyMapping;
  55.     //
  56.     
  57.     // ManyToMany
  58.         /**
  59.          * @ORM\ManyToMany(targetEntity="App\Entity\Slave\Ticket", inversedBy="ticketTags")
  60.          * @ORM\JoinTable(name="eposm_s_join_table_ticket_ticket_tag")
  61.          */
  62.         private $tickets;
  63.     //
  64.     public function __construct()
  65.     {
  66.         $this->tickets = new ArrayCollection();
  67.     }
  68.     public function getId(): ?string
  69.     {
  70.         return $this->id;
  71.     }
  72.     public function getName(): ?string
  73.     {
  74.         return $this->name;
  75.     }
  76.     public function setName(string $name): static
  77.     {
  78.         $this->name $name;
  79.         return $this;
  80.     }
  81.     public function getMappingValue(): ?string
  82.     {
  83.         return $this->mappingValue;
  84.     }
  85.     public function setMappingValue(string $mappingValue): static
  86.     {
  87.         $this->mappingValue $mappingValue;
  88.         return $this;
  89.     }
  90.     public function getColor(): ?string
  91.     {
  92.         return $this->color;
  93.     }
  94.     public function setColor(string $color): static
  95.     {
  96.         $this->color $color;
  97.         return $this;
  98.     }
  99.     public function getDatetimeStart(): ?\DateTimeInterface
  100.     {
  101.         return $this->datetimeStart;
  102.     }
  103.     public function setDatetimeStart(?\DateTimeInterface $datetimeStart): static
  104.     {
  105.         $this->datetimeStart $datetimeStart;
  106.         return $this;
  107.     }
  108.     public function getDatetimeEnd(): ?\DateTimeInterface
  109.     {
  110.         return $this->datetimeEnd;
  111.     }
  112.     public function setDatetimeEnd(?\DateTimeInterface $datetimeEnd): static
  113.     {
  114.         $this->datetimeEnd $datetimeEnd;
  115.         return $this;
  116.     }
  117.     public function getOperationKeyMapping(): ?OperationKeyMapping
  118.     {
  119.         return $this->operationKeyMapping;
  120.     }
  121.     public function setOperationKeyMapping(?OperationKeyMapping $operationKeyMapping): static
  122.     {
  123.         $this->operationKeyMapping $operationKeyMapping;
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return Collection<int, Ticket>
  128.      */
  129.     public function getTickets(): Collection
  130.     {
  131.         return $this->tickets;
  132.     }
  133.     public function addTicket(Ticket $ticket): static
  134.     {
  135.         if (!$this->tickets->contains($ticket)) {
  136.             $this->tickets->add($ticket);
  137.         }
  138.         return $this;
  139.     }
  140.     public function removeTicket(Ticket $ticket): static
  141.     {
  142.         $this->tickets->removeElement($ticket);
  143.         return $this;
  144.     }
  145. }