Magento2SampleModule
Magento2SampleModule copied to clipboard
Modifier load redundant data
I just found that Sample\News\Ui\DataProvider\Author\Form\Modifier\AuthorData
modifier load all data but should only one with specific author.
public function modifyData(array $data)
{
$items = $this->collection->getItems();
// here $items will contain all items present in DB, but should
// only filtered with specific author
/** @var $author \Sample\News\Model\Author */
foreach ($items as $author) {
Any ideas how to fix it?
BTW thanks for the nice sample module. It has started from 2015. Is it still actual with latest magento release?
@yaroslav-zenin That code looked strange to me too but I picked it up from the core. It's in the CMS module I just adapted it a bit If it's worth something, the collection always returns one single item everytime (or at least it did for me). I guess there are some magic filters applied somewhere based on the request params. So it is not actually loading the full collection.