Custom Events Manager in Phalcon\MVC\Models throws errors

Guys,

I've described the problem here:

http://stackoverflow.com/questions/19082505/custom-events-manager-in-phalcon-mvc-models-throws-errors

Appreciate your help.

Thanks, Temuri

P.S. Looks like it craps out when Model's ->modelsManager->customEventsManager is set.



27.6k

OK, after 6 hours of digging I found that problem occurs in the following block:

static PHP_METHOD(Phalcon_Mvc_Model_Manager, notifyEvent){
    if (phalcon_array_isset(custom_events_manager, entity_name)) {

        PHALCON_INIT_NVAR(fire_event_name);
        PHALCON_CONCAT_SV(fire_event_name, "mTodel:", event_name);

        PHALCON_INIT_NVAR(status);

        phalcon_call_method_p2_key(status, custom_events_manager, "fire", 210712414539UL, fire_event_name, model);

        if (PHALCON_IS_FALSE(status)) {
            RETURN_CCTOR(status);
        }
    }
}

Firing "model:beforeValidation" event crashes execution.

When calling phalconcallmethodp2key() method, "customeventsmanager" is not an object - it is an array, where model is indexed by array key name ("entity_name" here?).

Thus, shouldn't be call made on the "customeventsmanager->entity_name" ?

Thanks!



81.1k

This is fixed in 1.3.0