yiiext/nested-set-behavior

Event "HomeController.onAfterConstruct" is not defined.

kachar opened this issue · 5 comments

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.

@kachar how's that related to nested sets?

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.

This afterConstruct is about model, not controller.

cebe commented

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

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.