public function down(Application $app, Request $request, $productClassId)
{
$this->isTokenValid($app);
// FRONT_CART_DOWN_INITIALIZE
$event = new EventArgs(array('productClassId' => $productClassId), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CART_DOWN_INITIALIZE, $event);
try {
log_info('カート減算処理開始', array('product_class_id' => $productClassId));
$productClassId = $event->getArgument('productClassId');
$app['eccube.service.cart']->downProductQuantity($productClassId)->save();
// FRONT_CART_UP_COMPLETE
$event = new EventArgs(array('productClassId' => $productClassId), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CART_DOWN_COMPLETE, $event);
if ($event->hasResponse()) {
return $event->getResponse();
}
log_info('カート減算処理完了', array('product_class_id' => $productClassId));
} catch (CartException $e) {
log_info('カート減算エラー', array($e->getMessage()));
// FRONT_CART_DOWN_EXCEPTION
$event = new EventArgs(array('exception' => $e), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CART_DOWN_EXCEPTION, $event);
if ($event->hasResponse()) {
return $event->getResponse();
}
$app->addRequestError($e->getMessage());
}
return $app->redirect($app->url('cart'));
}