protected function executeInner(IWebRequest $request, IWebResponse $response, Feeding $feeding) { $whichBoob = $request->post('whichBoob', null); if (is_null($whichBoob)) { throw new Exception('Missing whichBoob'); } $totalMinutes = $request->post('totalMinutes', 0); $whichBoob = strtolower($whichBoob); switch ($whichBoob) { case 'left': $feeding->setBreastLeft($totalMinutes); break; case 'right': $feeding->setBreastRight($totalMinutes); break; default: throw new Exception('Unknown boob ' . $whichBoob); } }
protected function executeInner(IWebRequest $request, IWebResponse $response, Feeding $feeding) { $type = $request->post('type', null); if (is_null($type)) { throw new Exception('Missing type'); } $amount = $request->post('amount', 0); if ($amount > 0) { switch (strtolower($type)) { case 'milk': $type = Bottle::TYPE_MILK; break; case 'formula': $type = Bottle::TYPE_FORMULA; break; default: throw new Exception('Unknown type ' . $type); } $feeding->setBottle(new Bottle($type, $amount)); } }
protected function executeInner(IWebRequest $request, IWebResponse $response, Feeding $feeding) { $feeding->setMilking($request->post('amount', $feeding->getMilking())); }
protected function executeInner(IWebRequest $request, IWebResponse $response, Feeding $feeding) { $feeding->setPee($request->post('pee', $feeding->getPee())); $feeding->setPoo($request->post('poo', $feeding->getPoo())); }