/** * implement JsonSerializable interface * * @return array */ public function jsonSerialize() { return ['startDate' => new DateTime($this->startDate->format(self::DATE_LOCALE), $this->startDate->getTimeZone()), 'endDate' => new DateTime($this->endDate->format(self::DATE_LOCALE), $this->endDate->getTimeZone())]; }