117 \Psr\Log\LoggerInterface
$logger,
138 parent::__construct($context);
149 $allowGuest = $this->_objectManager->get(\
Magento\
Review\Helper\Data::class)->getIsGuestAllowToWrite();
154 if (!$allowGuest &&
$request->getActionName() ==
'post' &&
$request->isPost()) {
155 if (!$this->customerSession->isLoggedIn()) {
156 $this->_actionFlag->set(
'', self::FLAG_NO_DISPATCH,
true);
157 $this->customerSession->setBeforeAuthUrl($this->_url->getUrl(
'*/*/*', [
'_current' =>
true]));
158 $this->reviewSession->setFormData(
164 $this->_objectManager->get(\
Magento\
Customer\Model\Url::class)->getLoginUrl()
179 $this->_eventManager->dispatch(
'review_controller_product_init_before', [
'controller_action' => $this]);
180 $categoryId = (int)$this->
getRequest()->getParam(
'category',
false);
189 $category = $this->categoryRepository->get($categoryId);
190 $this->coreRegistry->register(
'current_category',
$category);
194 $this->_eventManager->dispatch(
'review_controller_product_init', [
'product' =>
$product]);
195 $this->_eventManager->dispatch(
196 'review_controller_product_init_after',
197 [
'product' =>
$product,
'controller_action' => $this]
199 }
catch (\
Magento\Framework\Exception\LocalizedException $e) {
200 $this->logger->critical($e);
223 if (!in_array($this->storeManager->getStore()->getWebsiteId(),
$product->getWebsiteIds())) {
227 if (!
$product->isVisibleInCatalog() || !
$product->isVisibleInSiteVisibility()) {
234 $this->coreRegistry->register(
'current_product',
$product);
235 $this->coreRegistry->register(
'product',
$product);
_redirect($path, $arguments=[])
__construct(\Magento\Framework\App\Action\Context $context, \Magento\Framework\Registry $coreRegistry, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository, \Psr\Log\LoggerInterface $logger, \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, \Magento\Review\Model\ReviewFactory $reviewFactory, \Magento\Review\Model\RatingFactory $ratingFactory, \Magento\Catalog\Model\Design $catalogDesign, \Magento\Framework\Session\Generic $reviewSession, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator)
dispatch(RequestInterface $request)