public function incrementCashAction(Request $request, $shopId) { $shop = $this->getRepository('BookkeepEntityBundle:Shop')->find($shopId); if (!$shop) { $this->getFlashBag()->add('error', 'Ошибка при пополнении кассы'); return $this->redirectToRoute('admin_shop_list'); } $cashQuantity = $request->request->get('form')['quantity']; $currentCash = $shop->getCash(); $shop->setCash($currentCash + $cashQuantity); $this->save($shop); $cashOperation = new CashOperation(); $cashOperation->setShop($shop); $cashOperation->setQuantity($cashQuantity); $cashOperation->setType("UP"); $comment = $request->request->get('form')['comment']; if ($comment) { $cashOperation->setComment($comment); } else { $cashOperation->setComment("Пополнена касса магазина #{$shop->getId()} на сумму {$cashQuantity} сом"); } $this->save($cashOperation); $this->getFlashBag()->add('success', 'Касса успешно пополнена'); return $this->redirectToRoute('admin_shop_show', array('id' => $shopId, 'org' => $this->container->get('session')->get('organization'))); }