<?php
namespace App\Entity;
use App\Repository\WardRepository;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: WardRepository::class), ORM\Table(name: 'wards')]
class Ward implements \Stringable
{
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
private $id;
#[ORM\ManyToOne(targetEntity: Hospital::class), ORM\JoinColumn(nullable: false), Assert\NotBlank]
private $hospital;
#[ORM\ManyToOne(targetEntity: WardType::class), ORM\JoinColumn(name: 'ward_type_id', nullable: false), Assert\NotBlank]
private $type;
#[ORM\ManyToOne(targetEntity: Symptom::class), ORM\JoinColumn(nullable: true)]
private $symptom;
#[ORM\Column(type: 'string', length: 100), Assert\NotBlank]
#[Assert\Length(
min: 0,
max: 20,
minMessage: 'Ward name must be at least {{ limit }} characters long',
maxMessage: 'Ward name cannot be longer than {{ limit }} characters'
)]
#[Assert\Regex(
pattern: '/\d/',
match: false,
message: 'Ward name cannot contain a number'
)]
private $name;
#[ORM\Column(type: 'integer'), Assert\NotBlank]
#[Assert\Length(
min: 0,
max: 4,
minMessage: 'Male Beds must be at least {{ limit }} number long',
maxMessage: 'Male Beds cannot be longer than {{ limit }} number'
)]
private $maleNumBed;
#[ORM\Column(type: 'integer'), Assert\NotBlank]
#[Assert\Length(
min: 0,
max: 4,
minMessage: 'Female Beds must be at least {{ limit }} number long',
maxMessage: 'Female Beds cannot be longer than {{ limit }} number'
)]
private int $femaleNumBed = 0;
#[ORM\Column(type: 'integer'), Assert\NotBlank]
#[Assert\Length(
min: 0,
max: 4,
minMessage: 'No. of Functional Female Beds must be at least {{ limit }} number long',
maxMessage: 'No. of Functional Female Beds cannot be longer than {{ limit }} number'
)]
private $maleNumBedFunc;
#[ORM\Column(type: 'integer'), Assert\NotBlank]
#[Assert\Length(
min: 0,
max: 4,
minMessage: 'No. of Functional Female Beds must be at least {{ limit }} number long',
maxMessage: 'No. of Functional Female Beds cannot be longer than {{ limit }} number'
)]
private int $femaleNumBedFunc = 0;
#[Gedmo\Timestampable(on: 'create'), ORM\Column(type: 'datetime')]
private $createdAt;
#[Gedmo\Timestampable(on: 'update'), ORM\Column(type: 'datetime')]
private $updatedAt;
public function getId(): ?int
{
return $this->id;
}
public function getHospital(): ?Hospital
{
return $this->hospital;
}
public function setHospital(?Hospital $hospital): self
{
$this->hospital = $hospital;
return $this;
}
public function getType(): ?WardType
{
return $this->type;
}
public function setType(WardType $type): self
{
$this->type = $type;
return $this;
}
public function getSymptom(): ?Symptom
{
return $this->symptom;
}
public function setSymptom(?Symptom $symptom): self
{
$this->symptom = $symptom;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = strip_tags($name);
return $this;
}
public function getMaleNumBed(): ?int
{
return $this->maleNumBed;
}
public function setMaleNumBed(int $maleNumBed): self
{
$this->maleNumBed = $maleNumBed;
return $this;
}
public function getMaleNumBedFunc(): ?int
{
return $this->maleNumBedFunc;
}
public function setMaleNumBedFunc(int $maleNumBedFunc): self
{
$this->maleNumBedFunc = $maleNumBedFunc;
return $this;
}
public function getFemaleNumBed(): ?int
{
return $this->femaleNumBed;
}
public function setFemaleNumBed(int $femaleNumBed): self
{
$this->femaleNumBed = $femaleNumBed;
return $this;
}
public function getFemaleNumBedFunc(): ?int
{
return $this->femaleNumBedFunc;
}
public function setFemaleNumBedFunc(int $femaleNumBedFunc): self
{
$this->femaleNumBedFunc = $femaleNumBedFunc;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function __toString(): string
{
return $this->getName();
}
}