public function aroundGetData(\Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider $subject, callable $proceed)
{
// what is do here
}
答案 0 :(得分:0)
感觉跳水不够深
对于全局使用而言,简便的方法是使用addField
甚至更改SQL以从某些相关表中添加数据。
public function aroundGetData(\Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider $subject, callable $proceed)
{
$subject->addField('field', 'alias'); // alias is optional
$collection = $subject->getCollection(); // Here you have access to all public methods of collection.
$select = $collection->getSelect(); // You can do whatever you want with Zend_DB_Select here
return $proceed();
}
DataProvider
具有addField
,而addFilter
方法在内部使用Product Collection
。