Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/code/Magento/Review/Block/Adminhtml/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

/**
* Adminhtml add Review main block
*
* @author Magento Core Team <[email protected]>
*/
class Add extends \Magento\Backend\Block\Widget\Form\Container
{
Expand Down
4 changes: 0 additions & 4 deletions app/code/Magento/Review/Block/Adminhtml/Add/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@

/**
* Adminhtml add product review form
*
* @author Magento Core Team <[email protected]>
*/
class Form extends \Magento\Backend\Block\Widget\Form\Generic
{
/**
* Review data
*
* @var \Magento\Review\Helper\Data
*/
protected $_reviewData = null;
Expand Down
2 changes: 0 additions & 2 deletions app/code/Magento/Review/Block/Adminhtml/Grid/Filter/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

/**
* Adminhtml review grid filter by type
*
* @author Magento Core Team <[email protected]>
*/
class Type extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

/**
* Adminhtml review grid item renderer for item type
*
* @author Magento Core Team <[email protected]>
*/
class Type extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
{
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Review/Block/Adminhtml/Product/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/**
* Adminhtml product grid block
*
* @author Magento Core Team <[email protected]>
* @SuppressWarnings(PHPMD.DepthOfInheritance)
*/
class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Review/Block/Adminhtml/Rating.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
* Ratings grid
*
* @api
* @author Magento Core Team <[email protected]>
* @since 100.0.2
*/
class Rating extends \Magento\Backend\Block\Widget\Grid\Container
{
/**
* Initialise the block
*
* @return void
*/
protected function _construct()
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Review/Block/Adminhtml/Rating/Edit/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

/**
* Rating edit form block
*
* @author Magento Core Team <[email protected]>
*/
class Form extends \Magento\Backend\Block\Widget\Form\Generic
{
/**
* Prepare the form
*
* @return $this
*/
protected function _prepareForm()
Expand Down
6 changes: 4 additions & 2 deletions app/code/Magento/Review/Block/Adminhtml/Rating/Edit/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

/**
* Admin rating left menu
*
* @author Magento Core Team <[email protected]>
*/
class Tabs extends \Magento\Backend\Block\Widget\Tabs
{
/**
* Initialise the block
*
* @return void
*/
protected function _construct()
Expand All @@ -24,6 +24,8 @@ protected function _construct()
}

/**
* Add rating information tab
*
* @return $this
*/
protected function _beforeToHtml()
Expand Down
10 changes: 6 additions & 4 deletions app/code/Magento/Review/Block/Customer/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* Customer Review detailed view block
*
* @api
* @author Magento Core Team <[email protected]>
* @since 100.0.2
*/
class View extends \Magento\Catalog\Block\Product\AbstractProduct
Expand Down Expand Up @@ -183,11 +182,14 @@ public function getTotalReviews()
{
if (!$this->getTotalReviewsCache()) {
$this->setTotalReviewsCache(
$this->_reviewFactory->create()->getTotalReviews($this->getProductData()->getId()),
false,
$this->_storeManager->getStore()->getId()
$this->_reviewFactory->create()->getTotalReviews(
$this->getProductData()->getId(),
false,
$this->_storeManager->getStore()->getId()
)
);
}

return $this->getTotalReviewsCache();
}

Expand Down
7 changes: 2 additions & 5 deletions app/code/Magento/Review/Block/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@
* Review form block
*
* @api
* @author Magento Core Team <[email protected]>
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @since 100.0.2
*/
class Form extends \Magento\Framework\View\Element\Template
{
/**
* Review data
*
* @var \Magento\Review\Helper\Data
*/
protected $_reviewData = null;
Expand Down Expand Up @@ -74,8 +71,6 @@ class Form extends \Magento\Framework\View\Element\Template
private $serializer;

/**
* Form constructor.
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Framework\Url\EncoderInterface $urlEncoder
* @param \Magento\Review\Helper\Data $reviewData
Expand Down Expand Up @@ -143,6 +138,8 @@ protected function _construct()
}

/**
* Return JavaScript layout object
*
* @return string
*/
public function getJsLayout()
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Review/Block/Form/Configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* Review form block
*
* @api
* @author Magento Core Team <[email protected]>
* @since 100.0.2
*/
class Configure extends \Magento\Review\Block\Form
Expand Down
3 changes: 0 additions & 3 deletions app/code/Magento/Review/Block/Product/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@
* Product Review Tab
*
* @api
* @author Magento Core Team <[email protected]>
* @since 100.0.2
*/
class Review extends Template implements IdentityInterface
{
/**
* Core registry
*
* @var \Magento\Framework\Registry
*/
protected $_coreRegistry;
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Review/Block/Product/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
/**
* Product Reviews Page
*
* @author Magento Core Team <[email protected]>
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class View extends \Magento\Catalog\Block\Product\View
Expand Down
2 changes: 0 additions & 2 deletions app/code/Magento/Review/Block/Rating/Entity/Detailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

/**
* Entity rating block
*
* @author Magento Core Team <[email protected]>
*/
class Detailed extends \Magento\Framework\View\Element\Template
{
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Review/Block/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* Review detailed view block
*
* @api
* @author Magento Core Team <[email protected]>
* @since 100.0.2
*/
class View extends \Magento\Catalog\Block\Product\AbstractProduct
Expand Down
15 changes: 10 additions & 5 deletions app/code/Magento/Review/Model/Rating.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@
* @method \Magento\Review\Model\Rating setStores(array $value)
* @method string getRatingCode()
*
* @author Magento Core Team <[email protected]>
* @since 100.0.2
*/
class Rating extends \Magento\Framework\Model\AbstractModel implements IdentityInterface
{
/**
* rating entity codes
*/
const ENTITY_PRODUCT_CODE = 'product';
public const ENTITY_PRODUCT_CODE = 'product';

const ENTITY_PRODUCT_REVIEW_CODE = 'product_review';
public const ENTITY_PRODUCT_REVIEW_CODE = 'product_review';

const ENTITY_REVIEW_CODE = 'review';
public const ENTITY_REVIEW_CODE = 'review';

/**
* @var \Magento\Review\Model\Rating\OptionFactory
Expand Down Expand Up @@ -75,6 +74,8 @@ protected function _construct()
}

/**
* Add a vote to an option
*
* @param int $optionId
* @param int $entityPkValue
* @return $this
Expand All @@ -94,6 +95,8 @@ public function addOptionVote($optionId, $entityPkValue)
}

/**
* Update a vote for an option
*
* @param int $optionId
* @return $this
*/
Expand All @@ -112,7 +115,7 @@ public function updateOptionVote($optionId)
}

/**
* retrieve rating options
* Retrieve rating options
*
* @return array
*/
Expand Down Expand Up @@ -143,6 +146,8 @@ public function getEntitySummary($entityPkValue, $onlyForCurrentStore = true)
}

/**
* Get summary of review
*
* @param int $reviewId
* @param bool $onlyForCurrentStore
* @return array
Expand Down
5 changes: 4 additions & 1 deletion app/code/Magento/Review/Model/Rating/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
* @method string getEntityCode()
* @method \Magento\Review\Model\Rating\Entity setEntityCode(string $value)
*
* @author Magento Core Team <[email protected]>
* @codeCoverageIgnore
*/
class Entity extends \Magento\Framework\Model\AbstractModel
{
/**
* Initialise the model
*
* @return void
*/
protected function _construct()
Expand All @@ -25,6 +26,8 @@ protected function _construct()
}

/**
* Return the ID for the specified code
*
* @param string $entityCode
* @return int
*/
Expand Down
7 changes: 6 additions & 1 deletion app/code/Magento/Review/Model/Rating/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
* @method int getPosition()
* @method \Magento\Review\Model\Rating\Option setPosition(int $value)
*
* @author Magento Core Team <[email protected]>
* @codeCoverageIgnore
* @since 100.0.2
*/
class Option extends \Magento\Framework\Model\AbstractModel
{
/**
* Initialise the model
*
* @return void
*/
protected function _construct()
Expand All @@ -33,6 +34,8 @@ protected function _construct()
}

/**
* Add a vote
*
* @return $this
*/
public function addVote()
Expand All @@ -42,6 +45,8 @@ public function addVote()
}

/**
* Set the identifier
*
* @param mixed $id
* @return $this
*/
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Review/Model/Rating/Option/Vote.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
* Rating vote model
*
* @api
*
* @author Magento Core Team <[email protected]>
* @codeCoverageIgnore
* @since 100.0.2
*/
class Vote extends \Magento\Framework\Model\AbstractModel
{
/**
* Initialise the class
*
* @return void
*/
protected function _construct()
Expand Down
6 changes: 1 addition & 5 deletions app/code/Magento/Review/Model/ResourceModel/Rating.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@
* Rating resource model
*
* @api
*
* @author Magento Core Team <[email protected]>
* @since 100.0.2
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Rating extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
const RATING_STATUS_APPROVED = 'Approved';
public const RATING_STATUS_APPROVED = 'Approved';

/**
* Store manager
*
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $_storeManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* Rating collection resource model
*
* @api
*
* @author Magento Core Team <[email protected]>
* @since 100.0.2
*/
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
Expand All @@ -26,7 +24,6 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab
protected $_ratingCollectionF;

/**
* Add store data flag
* @var bool
*/
protected $_addStoreDataFlag = false;
Expand Down Expand Up @@ -314,7 +311,9 @@ protected function _addStoreData()
if (is_array($data) && count($data) > 0) {
foreach ($data as $row) {
$item = $this->getItemById($row['rating_id']);
$item->setStores(array_merge($item->getStores(), [$row['store_id']]));
$stores = $item->getStores();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fredden This seems Like a good change maybe add it in the desciption of the pull request.

$stores[] = $row['store_id'];
$item->setStores(array_unique($stores));
}
}
return $this;
Expand Down
Loading