public function prepare() { parent::prepare(); if (!isset($this->baseControllerClass)) { $this->baseControllerClass; } }
public function prepare() { $this->codeProvider = new CodeProvider(); if (!$this->identificationColumn) { $this->identificationColumn = $this->tableSchema->primaryKey; } if (!array_key_exists($this->identificationColumn, $this->tableSchema->columns)) { $this->addError('identificationColumn', 'The specified column can not be found in the models attributes. <br /> Please specify a valid attribute. If unsure, leave the field empty.'); } parent::prepare(); }
public function prepare() { parent::prepare(); // Make sure that the Relation Widget is in the application components // Folder. if it is not, copy it over there $path = Yii::getPathOfAlias('application.components'); if ($path === false) { mkdir($path); } if (!is_dir($path)) { throw new CException('Fatal Error: Your application components/ is not an directory!'); } $names = scandir($path); if (!in_array('Relation.php', $names)) { $gtcpath = Yii::getPathOfAlias('ext.gtc.vendors'); if (!copy($gtcpath . '/Relation.php', $path . '/Relation.php')) { throw new CException('Relation.php could not be copied over to your components directory'); } } }
/** * This method is overridden to be able to copy certain templates to backend and frontend themes' view directories * More specifically, views placed in _frontend will be copied to the destination as specified by $this->frontendViewPathAlias * and views placed in _backend will be copied to the destination as specified by $this->backendViewPathAlias */ public function prepare() { parent::prepare(); // Add backend theme views $templatePath = $this->templatePath . DIRECTORY_SEPARATOR . "_backend"; if (is_dir($templatePath)) { $files = scandir($templatePath); foreach ($files as $file) { if (is_file($templatePath . '/' . $file) && CFileHelper::getExtension($file) === 'php') { $this->files[] = new CCodeFile(Yii::getPathOfAlias($this->backendViewPathAlias) . DIRECTORY_SEPARATOR . $this->getControllerID() . DIRECTORY_SEPARATOR . $file, $this->render($templatePath . '/' . $file)); } } } // Add frontend theme views $templatePath = $this->templatePath . DIRECTORY_SEPARATOR . "_frontend"; if (is_dir($templatePath)) { $files = scandir($templatePath); foreach ($files as $file) { if (is_file($templatePath . '/' . $file) && CFileHelper::getExtension($file) === 'php') { $this->files[] = new CCodeFile(Yii::getPathOfAlias($this->frontendViewPathAlias) . DIRECTORY_SEPARATOR . $this->getControllerID() . DIRECTORY_SEPARATOR . $file, $this->render($templatePath . '/' . $file)); } } } }