浏览文章
文章信息
Magento2 Call to a member function addFieldToFilter() on null
14918
DataProvider没有数据集Collection。换句话说就是getCollection时获得空值;
你需要在__construct函数中为$this->collection赋值。
类似这样:
function __construct( Collection $collection, $name, $primaryFieldName, $requestFieldName, array $meta = [], array $data = [] ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data); $this->collection = $collection; }