Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. protected $productCollectionFactory;
  2.  
  3.  
  4. public function __construct(
  5. .....
  6. CustomMyModuleModelResourceModelProductCollectionFactory $productCollectionFactory,
  7. ...
  8. ) {
  9. $this->productCollectionFactory = $productCollectionFactory;
  10. ....
  11. }
  12.  
  13. public function execute()
  14. {
  15. $collection = $this->productCollectionFactory->create()->load(1)->getData();
  16. var_dump($collection);
  17. die();
  18. return $collection;
  19. }
  20.  
  21. SELECT `main_table`.* FROM `custom_mymodule` AS `main_table`
  22. /home/magento2/Custom/MyModule/Controller/Product/products.php:68:
  23. array (size=1)
  24. 0 =>
  25. array (size=6)
  26. 'id' => string '1' (length=1)
  27. 'product_name' => string 'Moongoose' (length=30)
  28. 'product_sku' => string 'Moo74' (length=3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement