/** * @inheritdoc */ public function init() { parent::init(); if ($this->modelClass === null) { throw new InvalidConfigException("The property `modelClass` must be defined by the Controller."); } }
/** * Yii initializer. Find assets to register, and add them into the view if they are not ignore by $skipModuleAssets. */ public function init() { // call parent parent::init(); // get controller based assets foreach ($this->module->assets as $class) { $this->registerAsset($class); } }
public function behaviors() { $behaviors = parent::behaviors(); $behaviors[] = ['class' => 'yii\\filters\\ContentNegotiator', 'only' => ['callback'], 'formats' => ['application/json' => Response::FORMAT_JSON]]; return $behaviors; }