Magento Developer Certification Preparation Study Group

Session Five

Andreas Mautz || @mautz_et_tong

webvisum GmbH

Was?

EAV

Wer?

  • Andreas Mautz
  • programmiert seit 16 Jahren
  • macht magento seit 2008
  • beschäftigt sich mit Deployment-Prozessen, Entwicklungsinfrastrukturen und Wissensmanagement seit 2011
  • Vorbereitung Zertifizierung
  • Lehren und Lernen Stoff zusammenzufassen

Location

brandung

Next: ???

Ablauf

Was machen wir denn heute Schönes?

  • EAV
  • neue Aufgaben
  • Sonstiges

EAV

Entity–attribute–value model (EAV) is a data model to describe entities where the number of attributes (properties, parameters) that can be used to describe them is potentially vast, but the number that will actually apply to a given entity is relatively modest. In mathematics, this model is known as a sparse matrix. EAV is also known as object–attribute–value model, vertical database model and open schema.

EAV

Vorteile

  • Trennt Inhalte von Attributen und Entitäten
  • Verkapselung der attributbezogenen Geschäftslogik
  • Mehrschichtige Inhaltsauprägung möglich
  • Attributsverwaltung einfach

EAV

Hierarchie (insgesamt 147 Klassen)

  • App/Code/Core/Mage/Eav/Model/Form
  • App/Code/Core/Mage/Eav/Model/Form/Type.php
  • App/Code/Core/Mage/Eav/Model/Form/Element.php
  • App/Code/Core/Mage/Eav/Model/Form/Fieldset.php

EAV

Datenbankdiagramm

EAV

Eigenheiten

By decoupling the logical Model and the code that talks to the database,
it's theoretically possible to write new resource classes for a different
database schemas and platforms while keeping your Models themselves untouched.

EAV | Struktur

EAV | Load

Load entity’s attributes into the object

  • Read data from the main table (main table or entity table)
  • Define the attribute set of the object
  • Read the attribute’s value of the object
  • Change the attribute’s value (through the backend_model of the attribute)
  • Map date into the object

EAV | Save

Save entity’s attributes into the object’s resource

  • Take data mapped in the object
  • Change the attribute’s value (through the backend_model of the attribute)
  • Save data to the main table (main table hay entity table)
  • Save data to the attribute’s value table

EAV | Unterschiede

EAV regular
Load Join relevant tables together, then passing data to the object Save to multiple tables
Save Direct select from database Save to unique table

Attribute management | Bereiche

  • Frontend
  • Source
  • Backend

Attribute management | Interfaces

  • Frontend Interface - Frontend is providing the user interface for the attribute
  • Source Interface - Source is providing the selection options for user interface
  • Backend Interface - Backend is responsible for saving the values of the attribute and performing pre and post actions

neue Hausaufgaben!

für Session 6:

===========================================

Use a setup script to add a catalog/product select attribute using the Magento eav/entity_attribute_source_table. Also add some options

Add a customer/customer multiselect attribute using a customer source and backend model. Make it possible to unset all options for that attribute on customers using the Admin interface.

Add a catalog/product select attribute with a custom source model that is indexed by the flat table indexer, and that also works in the layered navigation.

Use a backend model to set the associated page and store_id entity properties.

Create an uninstall script (which would need to be run manually) from the comments module that leaves Magento in a state as if the module had never been installed.

Sonstiges

Quellen && nützliche Links

Magento

Danke!