Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
View.php
Go to the documentation of this file.
1 <?php
7 
12 use Magento\Review\Model\ReviewFactory;
13 
14 class View extends CustomerController
15 {
19  protected $reviewFactory;
20 
26  public function __construct(
27  Context $context,
29  ReviewFactory $reviewFactory
30  ) {
31  $this->reviewFactory = $reviewFactory;
32  parent::__construct($context, $customerSession);
33  }
34 
40  public function execute()
41  {
42  $review = $this->reviewFactory->create()->load($this->getRequest()->getParam('id'));
43  if ($review->getCustomerId() != $this->customerSession->getCustomerId()) {
45  $resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD);
46  $resultForward->forward('noroute');
47  return $resultForward;
48  }
50  $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
51  if ($navigationBlock = $resultPage->getLayout()->getBlock('customer_account_navigation')) {
52  $navigationBlock->setActive('review/customer');
53  }
54  $resultPage->getConfig()->getTitle()->set(__('Review Details'));
55  return $resultPage;
56  }
57 }
__()
Definition: __.php:13
__construct(Context $context, CustomerSession $customerSession, ReviewFactory $reviewFactory)
Definition: View.php:26