How to convert array data into Serialize format Magento 2.

Serialize array data using Magento 2 by natve SerializerInterface class.

The serialize method is used for storing or passing PHP values without losing their data type and structure.

serialize() method is used for serializing the data in Magento 2. Continue reading “How to convert array data into Serialize format Magento 2.”

How to Get Category Product Relation Table name Dynamically Magento 2?

You can get the category product table name dynamically using the Magento 2 Catalog module.

catalog_category_product table used for category-product relation.

The table contains entity_id, category_id, product_id, and position fields to manage relationships with products. Continue reading “How to Get Category Product Relation Table name Dynamically Magento 2?”

How to write a SQL Safe Query using quoteInto() method magento 2?

Using a SQL quoteInto() method, Write a Query using Magento standard way with SQL Safe quoted value.

You can avoid SQL injection attacks, no matter which database you use, is to separating the data value from the SQL statement. You can use ? to pass data in SQL query with the quoteInto() method.

Return Type: Always returns a string with SQL-safe quoted value placed into the original text.

You can use a given method in the direct SQL query for a safe quote with SQL conditions. Continue reading “How to write a SQL Safe Query using quoteInto() method magento 2?”