Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected $productCollectionFactory;
- public function __construct(
- .....
- CustomMyModuleModelResourceModelProductCollectionFactory $productCollectionFactory,
- ...
- ) {
- $this->productCollectionFactory = $productCollectionFactory;
- ....
- }
- public function execute()
- {
- $collection = $this->productCollectionFactory->create()->load(1)->getData();
- var_dump($collection);
- die();
- return $collection;
- }
- SELECT `main_table`.* FROM `custom_mymodule` AS `main_table`
- /home/magento2/Custom/MyModule/Controller/Product/products.php:68:
- array (size=1)
- 0 =>
- array (size=6)
- 'id' => string '1' (length=1)
- 'product_name' => string 'Moongoose' (length=30)
- 'product_sku' => string 'Moo74' (length=3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement