/** * * * @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; }
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; }
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; }
function updateItem(RequestFacade $request) { $req = RequestFacade::all(); $itemsDao = new ItemsDao(); return $this->jsonResponse($itemsDao->update($req)); }
function getCategory(RequestFacade $request) { $itemsDao = new ItemsDao(); $items = $itemsDao->getCategory(); return $this->jsonResponse($items); }