コード例 #1
0
 function getRecipe($id)
 {
     $selectString = 'SELECT * FROM Workflows NATURAL INNER JOIN Recipes  WHERE Id=' . $id;
     $result = $this->dbAdapter->query($selectString, Adapter::QUERY_MODE_EXECUTE);
     if (count($result) > 1) {
         throw new \Exception("Too many results when querying recipe");
     }
     $recipe = new Recipe();
     $recipe->exchangeArray($result->toArray());
     return $recipe;
 }
コード例 #2
0
 public function addRecipeAction()
 {
     //         $dbAdapter = $this->getServiceLocator()->get('Zend\Db\Adapter\Adapter');
     $addRecipeForm = new AddRecipeForm();
     $request = $this->getRequest();
     if ($request->isPost()) {
         //             echo "is post";
         $recipe = new Recipe();
         //             ini_set('xdebug.var_display_max_data', -1);
         //             ini_set('xdebug.var_display_max_depth', 5);
         //             ini_set('xdebug.var_display_max_children', 256);
         //             var_dump($_POST);
         /* set filter: no content yet
          */
         $addRecipeForm->setInputFilter($recipe->getInputFilter());
         $addRecipeForm->setData($request->getPost());
         if ($addRecipeForm->isValid()) {
             $this->getAddRecipeTable()->saveRecipe($addRecipeForm->getData());
             // Redirect to index
             //                 return $this->redirect()->toRoute('cookingassist');
         }
     }
     return array('form' => $addRecipeForm);
 }