0

Magento 2 how to get the data from 'rating_option_vote' by review_id using objectmanager?

3

You can use 'Magento\Review\Model\ResourceModel\Rating\Option\Vote\Collection'. Find the code for getting the collection and filtering it by 'review_id'.

<?php 
use Magento\Framework\App\Bootstrap;  
require __DIR__ . '/app/bootstrap.php';  
$bootstrap = Bootstrap::create(BP, $_SERVER);  
$obj = $bootstrap->getObjectManager();  
$state = $obj->get('Magento\Framework\App\State');  
$state->setAreaCode('frontend');  

$reviewId = 5; //custom review id.  
$ratingCollection = $obj->get('Magento\Review\Model\ResourceModel\Rating\Option\Vote\Collection')->addRatingInfo()->addOptionInfo()->addRatingOptions()->addFieldToFilter('review_id',$reviewId);  
print_r($ratingCollection->getData());
| improve this answer | |
  • thanks for your reply @venkatesankrish let me check and update you. – Nagaraju K Aug 2 '17 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.