Faster than eCommerce

NoCoast's Company Blog

Magento Models

Magento has simple models, which related directly to a database table. To handle complex or user defined information, Magento uses a data architecture called EAV, entity, attribute and value

Simple Models

Magento has 3 tiers to it’s data layer abstraction. This architecture lends itself well to adding more database interoperability and ease of refactoring in the future.

  • Database Adapter

    This tier will handle database connectivity and the native php methods or pdo implementation to interact with the data persistance service. As of now however only mySQL is supported.

  • Resource Model

    This abstraction handles the data serialization and conversion from instance properties to SQL. At the root of this is the Varien_Object class which implements the magic method __call to intercept setters and getters.

  • Business Model

    With the abstractions defined the final tier is where the business logic lies and where you can implement custom methods to fetch and save data as needed.

EAV Models

Magento’s approach to dynamic data models is called EAV, entity attribute and value. The idea behind this is similar to Drupal’s CCK system with a focus on efficiency to keep query times low.

The technical concept behind EAV Models is the ability to define “columns” on the object through another table. This allows the system to adapt to new information that needs to be stored without having to alter the data structure itself.

It does this by using the eav_attribute table to map information to models designed to support the EAV system. However eav_attribute doesn’t store any scalar data itself, just the reference to it. The data itself is actually abstracted again into it’s own table with a type specific column such as category_product_entity_varchar

Leave a reply

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

Need help? Email Us Here! Chat With Us Now!

← Prev Step

Thanks for contacting us. We'll get back to you as soon as we can.

Please provide a valid name, email, and question.

Powered by LivelyChat
Powered by LivelyChat Delete History