Skip to content

Instantly share code, notes, and snippets.

@colinmollenhour
Created December 6, 2011 21:28
Show Gist options
  • Save colinmollenhour/1440091 to your computer and use it in GitHub Desktop.
Save colinmollenhour/1440091 to your computer and use it in GitHub Desktop.
Mage_Index examination notes
Mage::getSingleton('index/indexer')->processEntityAction($entity, $entityType, $eventType)
'index/indexer'->logEvent($entity, $entityType, $eventType)
If indexer is locked, nothing happens
Creates a new 'index/event' instance, sets entity, type, data object, and primary key
Runs 'register' method of each 'index/process' which loads the indexer based on the xml config from 'global/index/indexer/<INDEXER>/model'
If event matches indexer using matchEvent method: (checks if the appropriate key/value is in indexer's _matchedEntities property)
Sets the event's namespace to the name of the indexer class
Calls the indexer's register method which matches the event again and calls the abstract method _registerEvent($event)
The indexer implementation now needs to add data to the eventusing addNewData
Adds the process id of the process to the event
Resets the event namespace
If event has process ids (a process indexer matched the event) index/indexer->indexEvent is called
Runs 'processEvent' method of each 'index/process'
If event matches indexer
Calls the indexer's _processEvent abstract method to process the event
callEventHandler is a provided method of calling a method named after the entity and event type using the indexer's resource model
The event is saved to the database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment