0

I have added an event for a custom entity to an Indexer but I have some issue:

  • _registerEvent() is called correctly
  • _processEvent() is never triggered

Here what I did:

In my Indexer Model I have add the Custom Entity/Event:

/**
 * @var array
 */
protected $_matchedEntities = array(
    MY_CUSTOM_ENTITY::ENTITY => array(
        Mage_Index_Model_Event::TYPE_SAVE,
        Mage_Index_Model_Event::TYPE_MASS_ACTION,
        Mage_Index_Model_Event::TYPE_DELETE
    )
);

In the custom entity model I added the call to logEvent()

protected function _beforeSave()
{
    parent::_beforeSave();
    Mage::getSingleton('index/indexer')->logEvent(
        $this, self::ENTITY, Mage_Index_Model_Event::TYPE_SAVE
    );
    return $this;
}
Fra
  • 6,965
  • 12
  • 65
  • 99

1 Answers1

1

What I was missing is the call to processEntityAction(), this is usually done on the entity _afterSave() method.

protected function _afterSave()
{
    parent::_afterSave();
    Mage::getSingleton('index/indexer')->processEntityAction(
        $this, self::ENTITY, Mage_Index_Model_Event::TYPE_SAVE
    );

    return $this;
}
Fra
  • 6,965
  • 12
  • 65
  • 99