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))
->addStoreData();
$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?