Esempio n. 1
0
 /**
  * 
  * 
  * @param type $request
  */
 function create($request)
 {
     $item = new OrderHasItems();
     if ($request['item_id']) {
         $itemsDao = new ItemsDao();
         $itemObj = $itemsDao->read($request['item_id']);
         $request['price'] = $itemObj->price;
     }
     $item = $this->setProperties($item, $request);
     $item->save();
     return $item;
 }
Esempio n. 2
0
 function addToOrderHistory($inputArray)
 {
     //@TODO add transaction
     //        $itemArray = $itemsDao->read($inputArray['item_id'])->toArray();
     /////////////////////////////
     if ($inputArray['item_id']) {
         $itemsDao = new ItemsDao();
         $itemArray = $itemsDao->read($inputArray['item_id'])->toArray();
     }
     $eoh = new OrderHistory();
     $eoh = $this->setProperties($eoh, array_merge($itemArray, $inputArray));
     $eoh->save();
     return $eoh;
 }
Esempio n. 3
0
 function getItemChildren($path = "/")
 {
     /**
      * @todo clean this shit
      */
     $itemsDao = new ItemsDao();
     $items = $itemsDao->getItemsByPath($path);
     $itemArray = array();
     foreach ($items as $value) {
         if (isset($itemArray[$value->path])) {
             $itemArray[$value->path][] = $value;
         } else {
             $itemArray[$value->path] = array();
         }
     }
     return $itemArray;
 }
Esempio n. 4
0
 function updateItem(RequestFacade $request)
 {
     $req = RequestFacade::all();
     $itemsDao = new ItemsDao();
     return $this->jsonResponse($itemsDao->update($req));
 }
Esempio n. 5
0
 function getCategory(RequestFacade $request)
 {
     $itemsDao = new ItemsDao();
     $items = $itemsDao->getCategory();
     return $this->jsonResponse($items);
 }