public function execute(IWebRequest $request, IWebResponse $response) { DebugLog::separator(); DebugLog::log($request->postAll()); $feeding = $this->feedingRepository->getInProgressOrNew(); $this->executeInner($request, $response, $feeding); if ($request->post('docommit', false)) { $feeding->setStatus(Feeding::STATUS_Finalized); $this->model->setStatus($feeding->getStatus()); } $this->feedingRepository->save($feeding); return $this->model; }
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; }
public function execute(IWebRequest $request, IWebResponse $response) { $this->model->setTitle('Track it baby!'); $this->model->setFeedings($this->feedingRepository->getAll()); return $this->model; }