Book Image

Magento PHP Developer's Guide

By : Allan MacGregor
Book Image

Magento PHP Developer's Guide

By: Allan MacGregor

Overview of this book

<p>Magento has completely reshaped the face of e-commerce since its launch in 2008. Its revolutionary focus on object oriented and EAV design patterns has allowed it to become the preferred tool for developers and retailers alike.</p> <p>"Magento PHP Developer’s Guide" is a complete reference to Magento, allowing developers to understand its fundamental concepts, and get them developing and testing Magento code.</p> <p>The book starts by building the reader’s knowledge of Magento, providing them with the information, techniques, and tools that they require to start their first Magento development.</p> <p>After building this knowledge, the book will then look at more advanced topics: how to test your code, how to extend the frontend and backend, and deploying and distributing custom modules.</p> <p>"Magento PHP Developer’s Guide" will help you navigate your way around your first Magento developments, helping you to avoid all of the most common headaches new developers face when first getting started.</p>
Table of Contents (16 chapters)
Magento PHP Developer's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Magento Model Anatomy


As we learned in the previous chapter, Magento Data Models are used to manipulate and access the data. The model layer is divided into two fundamental types, simple models and EAV, where:

  • Simple Models: These model implementations are simple mappings of one object to one table, meaning that our object attributes match each field and our table structure

  • Entity Attribute Value Models (EAV): These type of models are used to describe entities with a dynamic number of attributes

    Note

    Note that it is important to clarify that not all Magento Models extend or Mage use the ORM. Observers are a clear example of simpler Model classes that are not mapped to a specific database table or entity.

In addition to that, each Model type is formed by the following layers:

  • Model class: Here is where most of our business logic resides. Models are used to manipulate the data, but they don't access it directly.

  • Resource Model class: Resource Models are used to interact with the database on behalf...