Magento Developer Certification Preparation Study Group

Session Five

Andreas Mautz || @mautz_et_tong

webvisum GmbH

NACH RECHTS
Neue Location?

Was?

EAV

NACH UNTEN
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
NACH UNTEN

Locationcation

brandung

Next: ???

NACH RECHTS

Ablauf

Was machen wir denn heute Schönes?

  • EAV
  • neue Aufgaben
  • Sonstiges
NACH RECHTS
  • EAV
  • neue Aufgaben
  • Sonstiges
Reminder: Dev-Entwicklung mitbringen, wenn ihr Fragen habt Unterlagen mitbringen

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.

NACH UNTEN
https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model

EAV

Vorteile

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

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
NACH UNTEN

EAV

Datenbankdiagramm

  • siehe PDF

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.

NACH UNTEN
http://www.magestudyguide.com/

EAV | Struktur

NACH UNTEN
http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-5-magento-models-and-orm-basics

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
NACH UNTEN
http://blog.magestore.com/2012/04/04/magento-certificate-load-and-save-eav-entities/

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
NACH UNTEN
http://blog.magestore.com/2012/04/04/magento-certificate-load-and-save-eav-entities/

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
NACH UNTEN
http://blog.magestore.com/2012/04/04/magento-certificate-load-and-save-eav-entities/

Attribute management | Bereiche

  • Frontend
  • Source
  • Backend
NACH UNTEN

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
NACH UNTEN
http://www.magestudyguide.com/

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.

NACH UNTEN
Jemand vorstellen? Probleme? Fragen? Straight: 15 Minuten CUT!

Sonstiges

NACH UNTEN
Das wird geil, ich freu mich, verzeiht mir Fehler :)

Quellen && nützliche Links

Magento

  • Study Guide Quellensammlung
NACH RECHTS

Danke!

ENDE
Andreas Mautz || andreas.mautz@webvisum.de || webvisum.de