src/Entity/SectionPersonMeta.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Enum\SectionMetaType;
  4. use App\Repository\SectionPersonMetaRepository;
  5. use DateTime;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClass: SectionPersonMetaRepository::class)]
  8. class SectionPersonMeta
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type: 'integer')]
  13.     private $id;
  14.     #[ORM\Column(type: 'string', length: 255)]
  15.     private $value;
  16.     #[ORM\ManyToOne(targetEntity: SectionPerson::class, inversedBy: 'sectionPersonMetas')]
  17.     #[ORM\JoinColumn(nullable: false)]
  18.     private $sectionPerson;
  19.     #[ORM\ManyToOne(targetEntity: SectionMeta::class, inversedBy: 'sectionPersonMetas')]
  20.     #[ORM\JoinColumn(nullable: false)]
  21.     private $sectionMeta;
  22.     public function __toString(): string
  23.     {
  24.         $value = $this->getValue();
  25. //        if ($this->getSectionMeta()?->getType() === SectionMetaType::Date) {
  26. //        /** @var DateTime $value */
  27. //            return $value->format('d/m/y');
  28. //        }
  29.         return $value;
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getValue(): ?string
  36.     {
  37.         return $this->value;
  38.     }
  39.     public function setValue(string $value): self
  40.     {
  41.         $this->value = $value;
  42.         return $this;
  43.     }
  44.     public function getSectionPerson(): ?SectionPerson
  45.     {
  46.         return $this->sectionPerson;
  47.     }
  48.     public function setSectionPerson(?SectionPerson $sectionPerson): self
  49.     {
  50.         $this->sectionPerson = $sectionPerson;
  51.         return $this;
  52.     }
  53.     public function getSectionMeta(): ?SectionMeta
  54.     {
  55.         return $this->sectionMeta;
  56.     }
  57.     public function setSectionMeta(?SectionMeta $sectionMeta): self
  58.     {
  59.         $this->sectionMeta = $sectionMeta;
  60.         return $this;
  61.     }
  62. }