I can't seem to get request params from a Data Provider. I've modified Magento\Review\Ui\DataProvider\Product\ReviewDataProvider.php to log (also tried var_dump) the information, but it always returns null.

The following code is from Magento\Review\Ui\DataProvider\Product\ReviewDataProvider.php,

   public function getData()

        $this->getCollection()->addEntityFilter($this->request->getParam('current_product_id', 0))

        $arrItems = [
            'totalRecords' => $this->getCollection()->getSize(),
            'items' => [],

        foreach ($this->getCollection() as $item) {
            $arrItems['items'][] = $item->toArray([]);

        return $arrItems;

If I try to var_dump or log $this->request->getParam('current_product_id', 0), the result is null. This is the only point for the Collection to be filtered by the product ID (that I've found). I've also tried $this->getCollection()->getParams(), which shows some parameters, but the current_product_id is not included. Why does this happen and how can I view the request parameter?

  • Did you solve this ? May 30, 2022 at 3:02

1 Answer 1


In the function getData() in Magento\Review\Ui\DataProvider\Product\ReviewDataProvider.php is called by Magento 2 times. The first call is made by GET to {{domain_admin}}/mui/index/render/?namespace=review_listing&isAjax=true, in which only $this->request->getParams() the namespace variable and isAjax appear. And in the second call is made by POST and receives more parameters. Among them, the current_product_id

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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