src/Entity/Ward.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\WardRepository;
  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(repositoryClassWardRepository::class), ORM\Table(name'wards')]
  8. class Ward implements \Stringable
  9. {
  10.     #[ORM\IdORM\GeneratedValueORM\Column(type'integer')]
  11.     private $id;
  12.     #[ORM\ManyToOne(targetEntityHospital::class), ORM\JoinColumn(nullablefalse), Assert\NotBlank]
  13.     private $hospital;
  14.     #[ORM\ManyToOne(targetEntityWardType::class), ORM\JoinColumn(name'ward_type_id'nullablefalse), Assert\NotBlank]
  15.     private $type;
  16.     #[ORM\ManyToOne(targetEntitySymptom::class), ORM\JoinColumn(nullabletrue)]
  17.     private $symptom;
  18.     #[ORM\Column(type'string'length100), Assert\NotBlank]
  19.     #[Assert\Length(
  20.         min0,
  21.         max20,
  22.         minMessage'Ward name must be at least {{ limit }} characters long',
  23.         maxMessage'Ward name cannot be longer than {{ limit }} characters'
  24.     )]
  25.     #[Assert\Regex(
  26.         pattern'/\d/',
  27.         match: false,
  28.         message'Ward name cannot contain a number'
  29.     )]
  30.     private $name;
  31.     #[ORM\Column(type'integer'), Assert\NotBlank]
  32.     #[Assert\Length(
  33.         min0,
  34.         max4,
  35.         minMessage'Male Beds must be at least {{ limit }} number long',
  36.         maxMessage'Male Beds cannot be longer than {{ limit }} number'
  37.     )]
  38.     private $maleNumBed;
  39.     #[ORM\Column(type'integer'), Assert\NotBlank]
  40.     #[Assert\Length(
  41.         min0,
  42.         max4,
  43.         minMessage'Female Beds must be at least {{ limit }} number long',
  44.         maxMessage'Female Beds cannot be longer than {{ limit }} number'
  45.     )]
  46.     private int $femaleNumBed 0;
  47.     #[ORM\Column(type'integer'), Assert\NotBlank]
  48.     #[Assert\Length(
  49.         min0,
  50.         max4,
  51.         minMessage'No. of Functional Female Beds must be at least {{ limit }} number long',
  52.         maxMessage'No. of Functional Female Beds cannot be longer than {{ limit }} number'
  53.     )]
  54.     private $maleNumBedFunc;
  55.     #[ORM\Column(type'integer'), Assert\NotBlank]
  56.     #[Assert\Length(
  57.         min0,
  58.         max4,
  59.         minMessage'No. of Functional Female Beds must be at least {{ limit }} number long',
  60.         maxMessage'No. of Functional Female Beds cannot be longer than {{ limit }} number'
  61.     )]
  62.     private int $femaleNumBedFunc 0;
  63.     #[Gedmo\Timestampable(on'create'), ORM\Column(type'datetime')]
  64.     private $createdAt;
  65.     #[Gedmo\Timestampable(on'update'), ORM\Column(type'datetime')]
  66.     private $updatedAt;
  67.     public function getId(): ?int
  68.     {
  69.         return $this->id;
  70.     }
  71.     public function getHospital(): ?Hospital
  72.     {
  73.         return $this->hospital;
  74.     }
  75.     public function setHospital(?Hospital $hospital): self
  76.     {
  77.         $this->hospital $hospital;
  78.         return $this;
  79.     }
  80.     public function getType(): ?WardType
  81.     {
  82.         return $this->type;
  83.     }
  84.     public function setType(WardType $type): self
  85.     {
  86.         $this->type $type;
  87.         return $this;
  88.     }
  89.     public function getSymptom(): ?Symptom
  90.     {
  91.         return $this->symptom;
  92.     }
  93.     public function setSymptom(?Symptom $symptom): self
  94.     {
  95.         $this->symptom $symptom;
  96.         return $this;
  97.     }
  98.     public function getName(): ?string
  99.     {
  100.         return $this->name;
  101.     }
  102.     public function setName(string $name): self
  103.     {
  104.         $this->name strip_tags($name);
  105.         return $this;
  106.     }
  107.     public function getMaleNumBed(): ?int
  108.     {
  109.         return $this->maleNumBed;
  110.     }
  111.     public function setMaleNumBed(int $maleNumBed): self
  112.     {
  113.         $this->maleNumBed $maleNumBed;
  114.         return $this;
  115.     }
  116.     public function getMaleNumBedFunc(): ?int
  117.     {
  118.         return $this->maleNumBedFunc;
  119.     }
  120.     public function setMaleNumBedFunc(int $maleNumBedFunc): self
  121.     {
  122.         $this->maleNumBedFunc $maleNumBedFunc;
  123.         return $this;
  124.     }
  125.     public function getFemaleNumBed(): ?int
  126.     {
  127.         return $this->femaleNumBed;
  128.     }
  129.     public function setFemaleNumBed(int $femaleNumBed): self
  130.     {
  131.         $this->femaleNumBed $femaleNumBed;
  132.         return $this;
  133.     }
  134.     public function getFemaleNumBedFunc(): ?int
  135.     {
  136.         return $this->femaleNumBedFunc;
  137.     }
  138.     public function setFemaleNumBedFunc(int $femaleNumBedFunc): self
  139.     {
  140.         $this->femaleNumBedFunc $femaleNumBedFunc;
  141.         return $this;
  142.     }
  143.     public function getCreatedAt(): ?\DateTimeInterface
  144.     {
  145.         return $this->createdAt;
  146.     }
  147.     public function getUpdatedAt(): ?\DateTimeInterface
  148.     {
  149.         return $this->updatedAt;
  150.     }
  151.     public function __toString(): string
  152.     {
  153.         return $this->getName();
  154.     }
  155. }