Fetchall() mysql query in Magento 2.

Mysql fetchAll() query using Magento standard way for fetch all the records of the custom query.

You can fetch all the selected record from the table using direct SQL query fetchAll() without worry about the Model operation.

Return Type: fetchAll() always return as array based on your query conditions. Continue reading “Fetchall() mysql query in Magento 2.”

Add record using insert query in Magento 2.

You can create custom insert query using Magento 2 to add/create a new record in database table via ResourceConnection class.

Using the Insert query, You can add a new record to the table using direct SQL query insert() without going to model operation. Continue reading “Add record using insert query in Magento 2.”

Get all images of a product by product id magento 2.

You can get all the images assigned to specific products y product id.

You can get the details of products images like filename, media_type, position, and types.

using ProductRepositoryInterface you can get the images data using below code snippet, Continue reading “Get all images of a product by product id magento 2.”