Use ResourceModel\Product\CollectionFactory if you need a collection by product.
Continue reading “Get Product Collection in Magento 2”Category: Backend Development
Get Category Collection in Magento 2
Use the ResourceModel\Category\CollectionFactory if you need a collection by category. Example:
Continue reading “Get Category Collection in Magento 2”Get Category by Repository Interface
Get category item by ID. Use CategoryRepositoryInterface and NoSuchEntityException.
Continue reading “Get Category by Repository Interface”Sql query in magento – Resource Connection
If you need run sql query without repository or collection use ResourceConnection in your module.
Continue reading “Sql query in magento – Resource Connection”Repository testing in Magento 2
Repository is simple! Create file repository.php in folder /pub.
Continue reading “Repository testing in Magento 2”Model testing in Magento 2
Sometimes you need to quickly test the Model of your module or another vendor. And in order not to create a complete module, we can do it on one file.
Continue reading “Model testing in Magento 2”