<?php
namespace App\Entity;
use App\Entity\Enum\SectionMetaType;
use App\Repository\SectionPersonMetaRepository;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: SectionPersonMetaRepository::class)]
class SectionPersonMeta
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $value;
#[ORM\ManyToOne(targetEntity: SectionPerson::class, inversedBy: 'sectionPersonMetas')]
#[ORM\JoinColumn(nullable: false)]
private $sectionPerson;
#[ORM\ManyToOne(targetEntity: SectionMeta::class, inversedBy: 'sectionPersonMetas')]
#[ORM\JoinColumn(nullable: false)]
private $sectionMeta;
public function __toString(): string
{
$value = $this->getValue();
// if ($this->getSectionMeta()?->getType() === SectionMetaType::Date) {
// /** @var DateTime $value */
// return $value->format('d/m/y');
// }
return $value;
}
public function getId(): ?int
{
return $this->id;
}
public function getValue(): ?string
{
return $this->value;
}
public function setValue(string $value): self
{
$this->value = $value;
return $this;
}
public function getSectionPerson(): ?SectionPerson
{
return $this->sectionPerson;
}
public function setSectionPerson(?SectionPerson $sectionPerson): self
{
$this->sectionPerson = $sectionPerson;
return $this;
}
public function getSectionMeta(): ?SectionMeta
{
return $this->sectionMeta;
}
public function setSectionMeta(?SectionMeta $sectionMeta): self
{
$this->sectionMeta = $sectionMeta;
return $this;
}
}