<?phpnamespace App\Entity\Residence;use App\Entity\Camper\CamperProfile;use App\Entity\School\Student\StudentProfile;use Symfony\Component\Validator\Constraints as Assert;class RoomFilter implements \ArrayAccess, \Serializable, \JsonSerializable{ private ?Building $building = null; private ?Floor $floor = null; private ?Wing $wing = null; private ?string $extra = null; private ?string $modal = null; private \DateTimeInterface $startdate; private \DateTimeInterface $enddate; private ?Beds $bedspace=null; private ?OccupantInterface $occupant=null; private ?StudentProfile $student=null; private ?CamperProfile $camper=null; private ?bool $forCamper=null; private ?string $query=null; public function __construct() { $this->startdate=new \DateTime(); $this->enddate=new \DateTime(); } public function getBuilding(): ?Building { return $this->building; } /** * @param Building|null $building * * @return RoomFilter */ public function setBuilding(?Building $building): RoomFilter { $this->building = $building; return $this; } public function getFloor(): ?Floor { return $this->floor; } /** * @param Floor|null $floor * * @return RoomFilter */ public function setFloor(?Floor $floor): RoomFilter { $this->floor = $floor; return $this; } public function getWing(): ?Wing { return $this->wing; } /** * @param Wing|null $wing * * @return RoomFilter */ public function setWing(?Wing $wing): RoomFilter { $this->wing = $wing; return $this; } public function getExtra(): ?string { return $this->extra; } /** * @param string|null $extra * * @return RoomFilter */ public function setExtra(?string $extra): RoomFilter { $this->extra = $extra; return $this; } /** * @return string|null */ public function getModal(): ?string { return $this->modal; } /** * @param string|null $modal * * @return RoomFilter */ public function setModal(?string $modal): RoomFilter { $this->modal = $modal; return $this; } /** * @param string|null $modal */ /** * @return \DateTime */ public function getStartdate(): \DateTime { return $this->startdate; } /** * @param \DateTime $startdate * * @return RoomFilter */ public function setStartdate(\DateTime $startdate): RoomFilter { $this->startdate = $startdate; return $this; } /** * @param \DateTime $startdate */ /** * @return \DateTime */ public function getEnddate(): \DateTime { return $this->enddate; } /** * @param \DateTime $enddate * * @return RoomFilter */ public function setEnddate(\DateTime $enddate): RoomFilter { $this->enddate = $enddate; return $this; } /** * @param \DateTime $enddate */ /** * @return Beds|null */ public function getBedspace(): ?Beds { return $this->bedspace; } /** * @param Beds|null $bedspace * @return RoomFilter */ public function setBedspace(?Beds $bedspace): RoomFilter { $this->bedspace = $bedspace; return $this; } /** * @return Occupancy|null */ public function getOccupant(): ?OccupantInterface { return $this->occupant; } /** * @param OccupantInterface|null $occupant * * @return RoomFilter */ public function setOccupant(?OccupantInterface $occupant): RoomFilter { $this->occupant = $occupant; if($occupant instanceof StudentProfile) $this->student=$occupant; if($occupant instanceof CamperProfile) $this->camper=$occupant; return $this; } public function getForCamper(): ?bool { return $this->forCamper; } public function setForCamper(?bool $forCamper): void { $this->forCamper = $forCamper; } public function getStudent(): ?StudentProfile { return $this->student; } public function setStudent(?StudentProfile $student): RoomFilter { $this->student = $student; return $this; } public function getCamper(): ?CamperProfile { return $this->camper; } public function setCamper(?CamperProfile $camper): RoomFilter { $this->camper = $camper; return $this; } /** * @return string|null */ public function getQuery(): ?string { return $this->query; } /** * @param string|null $query * @return RoomFilter */ public function setQuery(?string $query): RoomFilter { $this->query = $query; return $this; } public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } public function offsetExists($offset) { return isset($this->container[$offset]); } public function offsetUnset($offset) { unset($this->container[$offset]); } public function offsetGet($offset) { return isset($this->container[$offset]) ? $this->container[$offset] : null; } public function jsonSerialize() { return get_object_vars($this); } public function serialize() { return serialize(get_object_vars($this)); } public function unserialize($serialized) {// dd($serialized); $properties = get_object_vars($this); $obj = json_decode($serialized); if (!is_object($obj)) { return; } foreach ($properties as $property => $value) {// if(array_key_exists($property,$obj)) if (property_exists($obj, $property)) { switch($property) { case "startdate": case "enddate": break; $this->$property = new \DateTime($obj->$property); default: $this->$property = $obj->$property; break; } } } }}