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;
}

1 Answer 1

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;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.