yiiext / nested-set-behavior

AR models behavior that allows to work with nested sets tree.
http://www.yiiframework.com/extension/nestedsetbehavior/
BSD 3-Clause "New" or "Revised" License
157 stars 64 forks source link

Event "HomeController.onAfterConstruct" is not defined. #23

Closed kachar closed 11 years ago

kachar commented 11 years ago

Using yii 1.1.14-dev

When I create empty onAfterConstruct method in the base controller it goes without exception, but this is a workaround.

samdark commented 11 years ago

@kachar how's that related to nested sets?

kachar commented 11 years ago

Well, nestedset bahvior is triggering attachment of this method in CModel by registering function afterConstruct at https://github.com/yiiext/nested-set-behavior/blob/master/NestedSetBehavior.php#L528

I think that having a new extension should not require any additional changes in the base controller of an application. This requirement is valid for any components that have this behavior attached.

samdark commented 11 years ago

This afterConstruct is about model, not controller.

cebe commented 11 years ago

@kachar you can only attach the behavior to a model, not a controller.

kachar commented 11 years ago

Thanks cebe, I was tying to apply the behavior to a controller, not an AR component. I'll try to be more precise with the next one. Thanks and sorry for the inconvenience.