Yii Framework Forum: Event assignment - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Event assignment Rate Topic: -----

#1 User is offline   dyrathror 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 07-October 08

Posted 12 October 2008 - 05:32 AM

I have one question about the assignment of Events to a Component.

Is it possible to assign Events to a Component in the same way as Actions are assigned to Controllers?


    public function actions()
    {
        return array(
            'edit'=>'application.controllers.EditAction',
        );
    }



0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,901
  • Joined: 04-October 08
  • Location:DC, USA

Posted 12 October 2008 - 06:20 AM

Do you mean define an event like defining an action in controller? Could you explain why you want to do so?
0

#3 User is offline   dyrathror 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 07-October 08

Posted 12 October 2008 - 08:37 AM

Yes, perhaps its just for convenience, to be able to do the same with events as with actions in controllers. Something like programming Events as own class and assigning them to the component like:


public function events()
{
    return array{
        'click'=>'application.components.events.ClickEvent',
    };
}


Or doesn't make that sense? I didn't dig much into the event handling code and don't know by now how they are handled.


0

#4 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,901
  • Joined: 04-October 08
  • Location:DC, USA

Posted 12 October 2008 - 08:42 AM

this just seems to be a shortcut to define event. It is inconvenent to inherit event though.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users