public function execute(IWebRequest $request, IWebResponse $response) { $feeding = $this->feedingRepository->getInProgress(); if ($feeding->hasBottle()) { $response->redirect('/bottle'); } else { if ($feeding->hasMilking()) { $response->redirect('/milking'); } else { if ($feeding->hasBreastFeeding()) { $response->redirect('/breast'); } else { if ($feeding->hasDiaper()) { $response->redirect('/diaper'); } } } } return $this->model; }
public function execute(IWebRequest $request, IWebResponse $response) { $this->model->setTemplateName($this->getTemplateName()); $this->model->setFeeding($this->feedingRepository->getInProgress()); $feeding = $this->model->getFeeding(); if ($feeding->hasBottle() && !$this->stringHelper->startsWith($request->path(), '/bottle')) { $response->redirect('/bottle'); } else { if ($feeding->hasMilking() && !$this->stringHelper->startsWith($request->path(), '/milking')) { $response->redirect('/milking'); } else { if ($feeding->hasBreastFeeding() && !$this->stringHelper->startsWith($request->path(), '/breast')) { $response->redirect('/breast'); } else { if ($feeding->hasDiaper() && !$this->stringHelper->startsWith($request->path(), '/diaper')) { $response->redirect('/diaper'); } } } } return $this->model; }