src/Entity/Symptom.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SymptomRepository;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. #[ORM\Entity(repositoryClassSymptomRepository::class), ORM\Table(name'symptoms')]
  8. class Symptom implements \Stringable
  9. {
  10.     #[ORM\IdORM\GeneratedValueORM\Column(type'integer')]
  11.     private $id;
  12.     #[ORM\ManyToOne(targetEntityDiseaseCategory::class, inversedBy'symptoms')]
  13.     #[ORM\JoinColumn(name'category_id'nullablefalse), Assert\NotBlank]
  14.     private $diseaseCategory;
  15.     #[ORM\Column(type'string'length255), Assert\NotBlank]
  16.     #[Assert\Length(
  17.         min2,
  18.         max20,
  19.         minMessage'Symptom name must be at least {{ limit }} characters long',
  20.         maxMessage'Symptom name cannot be longer than {{ limit }} characters'
  21.     )]
  22.     #[Assert\Regex(
  23.         pattern'/\d/',
  24.         match: false,
  25.         message'Symptom name cannot contain a number'
  26.     )]
  27.     private $name;
  28.     #[ORM\Column(type'boolean')]
  29.     private bool $isActive true;
  30.     #[Gedmo\Timestampable(on'create'), ORM\Column(type'datetime')]
  31.     private $createdAt;
  32.     #[Gedmo\Timestampable(on'update'), ORM\Column(type'datetime')]
  33.     private $updatedAt;
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getDiseaseCategory(): ?DiseaseCategory
  39.     {
  40.         return $this->diseaseCategory;
  41.     }
  42.     public function setDiseaseCategory(?DiseaseCategory $diseaseCategory): self
  43.     {
  44.         $this->diseaseCategory $diseaseCategory;
  45.         return $this;
  46.     }
  47.     public function getName(): ?string
  48.     {
  49.         return $this->name;
  50.     }
  51.     public function setName(string $name): self
  52.     {
  53.         $this->name $name;
  54.         return $this;
  55.     }
  56.     public function getIsActive(): ?bool
  57.     {
  58.         return $this->isActive;
  59.     }
  60.     public function setIsActive(bool $isActive): self
  61.     {
  62.         $this->isActive $isActive;
  63.         return $this;
  64.     }
  65.     public function getCreatedAt(): ?\DateTimeInterface
  66.     {
  67.         return $this->createdAt;
  68.     }
  69.     public function getUpdatedAt(): ?\DateTimeInterface
  70.     {
  71.         return $this->updatedAt;
  72.     }
  73.     public function __toString(): string
  74.     {
  75.         return $this->getName();
  76.     }
  77. }