private function populate(array $row)
 {
     $x = new Feeding();
     $x->setId($row['id']);
     $x->setBreastLeft($row['breast_left']);
     $x->setBreastRight($row['breast_right']);
     $x->setMilking($row['milking']);
     $x->setPee($row['pee']);
     $x->setPoo($row['poo']);
     $x->setDateTime(new DateTime($row['date_time']));
     $x->setStatus($row['status']);
     if (!empty($row['bottle'])) {
         $bottle = new Bottle(Bottle::TYPE_MILK, 0);
         $bottle->decode($row['bottle']);
         $x->setBottle($bottle);
     }
     return $x;
 }
 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));
     }
 }