Quick Question On Behaviors Setting In

How do I configure multiple receivers of a onBeginRequest in config/main.php? I have tried all sorts of variations and I can’t get the second method to fire.


        'behaviors' => array(

                'onBeginRequest' =>

                        array('class' => 'application.components.InitSoap'),

                'onBeginRequest' =>

                        array('class' => 'application.components.RequireAppLogin'),


First, if you declare a key in an array twice the second one overwrites the first one.

Second, the key in the ‘behaviors’ array is just the behavior name, it has to be unique but it’s not used otherwise.

Third, are you trying to attach something to an event?

I’m trying to execute two separate functions for the application’s onBeginRequest event. How do I do that?

The two class listed both extend CBehavior, each has an attach method that calls attachEventHandler($this, ‘functname’) where functname holds the code I want to execute.

So just use unique keys in that array.

Ok. I just got tripped up on the name. I thought the key had to be the event name. I realize the event is actually defined in the extended class. Duh.

Thanks for setting me straight.