Magento 2 magento 2 interview question, magento2

Magento 2 Interview Questions

• What is Magento?

Magento is an open source-eCommerce web application developed by Varien, launched on 31st March 2008. Magento was built by using the part of the Zend Framework and using the EAV (entity-attribute-value) database model to save the data. Now Magento is a division of eBay. On June 6, 2011, eBay owns 100% of Magento.

Magento can be divided into four architectural layers.

Presentation Layer: is the one that we directly interact with through the browsers. It contains layouts blocks, templates and even controllers. Clients side technologies like jQuery Requirejs CSS and LESS are also part of this layer.

Service Layer: is the bridge between the presentation layer and domain layer. It contains service contracts which define the implementation behavior. This layer is where we can find the REST/SOAP APIs.

Domain Layer: is really the business layer of Magento. This layer is all about generic data objects and modules that compose the business logic. This layered contains event observers, plugins and di.xml definitions.

Persistence Layer: is where the data gets persisted. This layer is in charge of all the CURD requests.

Magento introduces many features to make it easier.

  • Catalog and Category Management
  • Customer Management
  • Order Management
  • Marketing Promotion
  • Reporting and Analytics
  • Payment, integrated with PayPal,
  • Shipping
  • Search Engine Optimization(SEO)
• What is Object Manager in Magento?

The initialization of objects in Magento is done via what is called the object manager. The Object Manager itself is an instant of the Magento\Framework\ObjectManager\ObjectManager class that implements the Magento\Framework\ObjectManagerInterface class.

For more reference of Magento 2 Obejct Manager

• What is EAV in Magento?

EAV stands for Entity Attribute Value, is a technique which allows you to add unlimited columns to your table virtually. EAV also known as object attribute value model and open schema.

Entity (E): Entity actually refers to data item. For example we can consider it as customer, category or product.

Attribute (A): Attribute refers to the different attributes of the Entity. Like for example product have different attributes like color, size, price, etc.

Value (V): Value refers to the actual value of the attribute of the entity. Like color has value red, price has value $25, etc.

In EAV, you have one table which holds all the “attribute” (table field names) data, and other tables which hold the “entity” (id or primary id) and value (value for that id) against each attribute.

In Magento, there is one table to hold attribute values called eav_attribute and 5-6 tables which holds entity and data in fully normalized form

eav_entity, eav_entity_int (for holding Integer values),

eav_entity_varchar (for holding Varchar values),

eav_entity_datetime (for holding Datetime values),

eav_entity_decimal (for holding Decimal/float values),

eav_entity_text (for holding text (mysql Text type) values).

EAV is expensive and should only be used when you are not sure about number of fields in a table which can vary in future. To just get one single record, Magento joins 4-5 tables to get data in EAV. But this doesn’t mean that EAV only has drawbacks. The main advantage of EAV is adding the table column will not affect the previously saved records (also the extra space will not get allocated!) and all the new records will seamlessly have data in these columns without any problem.

• Which command is used to enable or disable a magento2 module?
  • php bin/magento module:enable NameSpace_ModuleName
  • php bin/magento module:disable NameSpace_ModuleName
• Which files are necessary to install – upgrade database tables and to records in it?

Normally, there are four files for this listed below

  • InstallSchema
  • UpgradeSchema
  • InstallData
  • UpgradeData
• What are the recommended steps to be followed before Magento2 programming?

Before development starts,

  • disable the whole cache.
  • Set Development mode as SetEnv MAGE_MODE developer in .htacces or run the command php bin/magento deploy:mode:set developer
  • Switch off xdebug (php.ini settings) in development environment mode so the process can run faster.
• Which file is responsible for keeping database credentials in Magento2?

It’s env.php situated at app/etc/ folder.

• Which file stores the vendor path?

It’s vendor_path.php situated at app/etc/ folder.

• Which class Magento 2 helper extend?


• Which function refers to the action in any controller file?

Its execute() function

• What is the difference between cache: clean and cache: flush?

Typically, cache: clean deletes all enabled cache related to Magento whereas cache: flush deletes the whole cache storage, whether its Magento cache or any third party cache (whether enabled or disabled)

• What is the resource attribute for admin menu item?

Resource attribute defines the ACL rule, that a user must have in order to access this Menu Item

• Where do all core modules are located in Magento2?

They are under vendor/magento folder.

• Where is the module’s base definition file?

They are at app/code/Module/etc/module.xml.

Leave a Reply

Your email address will not be published. Required fields are marked *