<?phpnamespace App\Entity;use App\Entity\Camper\CamperGroup;use App\Interface\EntityFilterInterface;use phpDocumentor\Reflection\Types\Boolean;class AbstractFilter implements EntityFilterInterface, \ArrayAccess, \Serializable, \JsonSerializable{ protected ?string $query=null; protected ?\DateTimeInterface $startDate = null; protected ?\DateTimeInterface $endDate = null; public function getQuery(): ?string { return $this->query; } public function setQuery(?string $query): AbstractFilter { $this->query = $query; return $this; } public function getStartDate(): ?\DateTimeInterface { return $this->startDate; } public function setStartDate(?\DateTimeInterface $startDate): AbstractFilter { $this->startDate = $startDate; return $this; } public function getEndDate(): ?\DateTimeInterface { return $this->endDate; } public function setEndDate(?\DateTimeInterface $endDate): AbstractFilter { $this->endDate = $endDate; return $this; } /***********************************************/ public function jsonSerialize() { return get_object_vars($this); } function __serialize() { return get_object_vars($this); } function __unserialize($array) { $this->unserialize(json_encode($array)); } public function serialize() { return serialize(get_object_vars($this)); } public function unserialize($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": $this->$property = new \DateTime($obj->$property); break; default: $this->$property = $obj->$property; break; } } } } 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; }}