jbernier
(Jbernier)
1
Hi everybody,
I follow the instruction for CTimestampBehavior and I get an error like :
« PhFabricantController.onAfterConstruct » not defined.
I just add this to my controller.
public function behaviors() {
return array(
'CTimestampBehavior' => array(
'class' => 'zii.behaviors.CTimestampBehavior',
)
);
}
}
Note : My controller derive from CControler
Any clue what I missed ?
phtamas
(Phtamas)
2
Please read documentation carefully:
jbernier
(Jbernier)
3
My model is defined like this :
class PhFabricant extends BasePhFabricant
and
abstract class BasePhFabricant extends I18nActiveRecord
and
class I18nActiveRecord extends CActiveRecord
I must also say that afterConstruct event is overided in the I18nActiveRecord class.
How can I do the same as CTimestampBehavior with this ?
phtamas
(Phtamas)
4
That’s not a problem, if done properly.
Just attach behavior to PhFabricant model (rather than controller) as described in the documentation. It should work.
jbernier
(Jbernier)
5
Thank you, that worked fine. Have a nice day.