Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. /**
  2. * DataProvider constructor.
  3. * @param $name
  4. * @param $primaryFieldName
  5. * @param $requestFieldName
  6. * @param array $meta
  7. * @param array $data
  8. */
  9. public function __construct(
  10. $name,
  11. $primaryFieldName,
  12. $requestFieldName,
  13. array $meta = [],
  14. array $data = []
  15. ) {
  16. $objectManager = MagentoFrameworkAppObjectManager::getInstance();
  17. $product = MagentoCatalogModelProduct;
  18. $this->collection = $objectManager->create("CommercersStockLogModelStockLog")->getCollection();
  19. $this->collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
  20. $this->collection->getSelect()->join(array('catalog_product_entity' => $product), 'main_table.product_id = catalog_product_entity.entity_id');
  21. parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
  22.  
  23. }
  24.  
  25. public function getData()
  26. {
  27. $data = [];
  28. foreach($this->getCollection()->getItems() as $item){
  29. $data[$item->getId()] = array('stocklog_columns' => $item->getData());
  30. }
  31. return $data;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement