* @since 2.0 */ abstract class ApplicationComponent extends Component implements Initable { /** * @var array the behaviors that should be attached to this component. * The behaviors will be attached to the component when [[init]] is called. * Please refer to [[Model::behaviors]] on how to specify the value of this property. */ public $behaviors = array(); /** * Pre-initializes this component. * This method is required by the [[Initable]] interface. It is invoked by * [[\Yii::createComponent]] after its creates the new component instance but * BEFORE the component properties are initialized. * * You may override this method to do work such as setting property default values. */ public function preinit() { } /** * Initializes the application component. * This method is invoked after the component is created and its property values are * initialized. The default implementation will call [[Component::attachBehaviors]] * to attach behaviors declared in [[behaviors]]. * If you override this method, make sure to call the parent implementation. */ public function init() { $this->attachBehaviors($this->behaviors); } }