src/Entity/LookUpTableData.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LookUpTableDataRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Timestampable\Traits\TimestampableEntity;
  9. #[ORM\Entity(repositoryClassLookUpTableDataRepository::class)]
  10. class LookUpTableData
  11. {
  12.     use TimestampableEntity;
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\ManyToOne(inversedBy'lookUpTableData'fetch:'EAGER')]
  18.     private ?LookUpTable $lookUpTable null;
  19.     #[ORM\Column(length255nullabletrue)]
  20.     private ?string $returnValue null;
  21.     #[ORM\OneToMany(mappedBy'lookUpTableData'targetEntityLookUpTableDataValue::class, cascade: ['persist''remove'])]
  22.     private Collection $lookUpTableDataValues;
  23.     #[ORM\Column]
  24.     private ?int $ind 0;
  25.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  26.     private ?\DateTimeInterface $startDate null;
  27.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  28.     private ?\DateTimeInterface $endDate null;
  29.     public function __construct()
  30.     {
  31.         $this->lookUpTableDataValues = new ArrayCollection();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getLookUpTable(): ?LookUpTable
  38.     {
  39.         return $this->lookUpTable;
  40.     }
  41.     public function setLookUpTable(?LookUpTable $lookUpTable): static
  42.     {
  43.         $this->lookUpTable $lookUpTable;
  44.         return $this;
  45.     }
  46.     public function getReturnValue(): ?string
  47.     {
  48.         return $this->returnValue;
  49.     }
  50.     public function setReturnValue(?string $returnValue): static
  51.     {
  52.         $this->returnValue $returnValue;
  53.         return $this;
  54.     }
  55.     /**
  56.      * @return Collection<int, LookUpTableDataValue>
  57.      */
  58.     public function getLookUpTableDataValues(): Collection
  59.     {
  60.         return $this->lookUpTableDataValues;
  61.     }
  62.     public function addLookUpTableDataValue(LookUpTableDataValue $lookUpTableDataValue): static
  63.     {
  64.         if (!$this->lookUpTableDataValues->contains($lookUpTableDataValue)) {
  65.             $this->lookUpTableDataValues->add($lookUpTableDataValue);
  66.             $lookUpTableDataValue->setLookUpTableData($this);
  67.         }
  68.         return $this;
  69.     }
  70.     public function removeLookUpTableDataValue(LookUpTableDataValue $lookUpTableDataValue): static
  71.     {
  72.         if ($this->lookUpTableDataValues->removeElement($lookUpTableDataValue)) {
  73.             // set the owning side to null (unless already changed)
  74.             if ($lookUpTableDataValue->getLookUpTableData() === $this) {
  75.                 $lookUpTableDataValue->setLookUpTableData(null);
  76.             }
  77.         }
  78.         return $this;
  79.     }
  80.     public function getInd(): ?int
  81.     {
  82.         return $this->ind;
  83.     }
  84.     public function setInd(int $ind): static
  85.     {
  86.         $this->ind $ind;
  87.         return $this;
  88.     }
  89.     public function __toString(): string
  90.     {
  91.         $data = [];
  92.         foreach ($this->lookUpTableDataValues as $lookUpTableDataValue) {
  93.             if($lookUpTableDataValue->getValue()){
  94.                 $data[] = $lookUpTableDataValue->getValue();
  95.             }
  96.         }
  97.         return implode(", "$data);
  98.     }
  99.     public function getStartDate(): ?\DateTimeInterface
  100.     {
  101.         return $this->startDate;
  102.     }
  103.     public function setStartDate(?\DateTimeInterface $startDate): static
  104.     {
  105.         $this->startDate $startDate;
  106.         return $this;
  107.     }
  108.     public function getEndDate(): ?\DateTimeInterface
  109.     {
  110.         return $this->endDate;
  111.     }
  112.     public function setEndDate(?\DateTimeInterface $endDate): static
  113.     {
  114.         $this->endDate $endDate;
  115.         return $this;
  116.     }
  117. }