In Magento commerce, Retrieve the value of the link field for the specific entity type programmatically to join database query.
Magento uses $metadata->getLinkField() to get the name of the field for the given entity type using MetadataPool class.
You need to pass the entity type interface to fetch the link field name. When you working with Magento commerce, you required entity link field value instead of table primary key entity_id to join query with other database tables. Continue reading “How to get entity type link field value in Magento 2 Commerce?”
You can write a select query in Magento 2 to retrieve records from the table. The select query can be written with best practice to avoid security breaches.
Example, You are searching for records from the core_config_data table,
Row query is:
SELECT * FROM
scope = ‘default’ AND
path = ‘general/locale/code’
You can direct use above string as query and pass it to the query() method but it’s not a secure way to write a select query. I will show you the standard Magento way to write database queries with the best secure standard Practice. Continue reading “How to Write Select Query in Magento 2 with Standard way?”
You can add a new column field under the admin_user core table using the db_schema.xml file for Magento 2.3 and the Higher version.
The client has a requirement like, store the current user location based on their geographical area. Continue reading “Add New Column in admin_user table Magento 2.”