Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ProductDataProvider.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
12 
20 {
24  private $pool;
25 
35  public function __construct(
36  $name,
39  CollectionFactory $collectionFactory,
40  PoolInterface $pool,
41  array $meta = [],
42  array $data = []
43  ) {
44  parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
45  $this->collection = $collectionFactory->create();
46  $this->pool = $pool;
47  }
48 
53  public function getData()
54  {
56  foreach ($this->pool->getModifiersInstances() as $modifier) {
57  $this->data = $modifier->modifyData($this->data);
58  }
59 
60  return $this->data;
61  }
62 
67  public function getMeta()
68  {
69  $meta = parent::getMeta();
70 
72  foreach ($this->pool->getModifiersInstances() as $modifier) {
73  $meta = $modifier->modifyMeta($meta);
74  }
75 
76  return $meta;
77  }
78 }
__construct( $name, $primaryFieldName, $requestFieldName, CollectionFactory $collectionFactory, PoolInterface $pool, array $meta=[], array $data=[])