Skip to content

Commit

Permalink
core modified as per instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
saphal committed Oct 30, 2018
1 parent 611969d commit 774164c
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions app/code/Magento/Review/Model/ResourceModel/Rating.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,12 @@ class Rating extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
*/
protected $_logger;

/**
* @var \Magento\Framework\App\State
*/
protected $_state;

/**
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
* @param \Psr\Log\LoggerInterface $logger
* @param \Magento\Framework\Module\Manager $moduleManager
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Review\Model\ResourceModel\Review\Summary $reviewSummary
* @param \Magento\Framework\App\State
* @param string $connectionName
*/
public function __construct(
Expand All @@ -54,14 +48,12 @@ public function __construct(
\Magento\Framework\Module\Manager $moduleManager,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Review\Model\ResourceModel\Review\Summary $reviewSummary,
\Magento\Framework\App\State $state,
$connectionName = null
) {
$this->moduleManager = $moduleManager;
$this->_storeManager = $storeManager;
$this->_logger = $logger;
$this->_reviewSummary = $reviewSummary;
$this->_state = $state;
parent::__construct($context, $connectionName);
}

Expand Down Expand Up @@ -433,11 +425,11 @@ public function getReviewSummary($object, $onlyForCurrentStore = true)

$data = $connection->fetchAll($select, [':review_id' => $object->getReviewId()]);

$currentStore = ($this->_state->getAreaCode() == "adminhtml") ? false : $this->_storeManager->getStore()->getId();
$currentStore = ($this->_storeManager->isSingleStoreMode()) ? $this->_storeManager->getStore()->getId() : NULL ;

if ($onlyForCurrentStore) {
foreach ($data as $row) {
if ($row['store_id'] == $currentStore) {
if (!$row['store_id'] == NULL) {
$object->addData($row);
}
}
Expand Down

0 comments on commit 774164c

Please sign in to comment.