public function scheduleDowntime(ScheduleServiceDowntimeCommand $downtime, Request $request) { $downtime->setComment($this->getElement('comment')->getValue())->setAuthor($request->getUser()->getUsername())->setStart($this->getElement('start')->getValue()->getTimestamp())->setEnd($this->getElement('end')->getValue()->getTimestamp()); if ($this->getElement('type')->getValue() === self::FLEXIBLE) { $downtime->setFixed(false); $downtime->setDuration((double) $this->getElement('hours')->getValue() * 3600 + (double) $this->getElement('minutes')->getValue() * 60); } $this->getTransport($request)->send($downtime); }