當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CCodeModel::init方法代碼示例

本文整理匯總了PHP中CCodeModel::init方法的典型用法代碼示例。如果您正苦於以下問題:PHP CCodeModel::init方法的具體用法?PHP CCodeModel::init怎麽用?PHP CCodeModel::init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CCodeModel的用法示例。


在下文中一共展示了CCodeModel::init方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init

 public function init()
 {
     if (Yii::app()->db === null) {
         throw new CHttpException(500, 'An active "db" connection is required to run this generator.');
     }
     parent::init();
 }
開發者ID:israelCanul,項目名稱:Bonanza_V2,代碼行數:7,代碼來源:CrudCode.php

示例2: init

 public function init()
 {
     if (Yii::app()->{$this->connectionId} === null) {
         throw new CHttpException(500, 'A valid database connection is required to run this generator.');
     }
     $this->tablePrefix = Yii::app()->{$this->connectionId}->tablePrefix;
     parent::init();
 }
開發者ID:42point,項目名稱:Vinum,代碼行數:8,代碼來源:ModelCode.php

示例3: init

 /**
  * Runs on object initiation
  */
 public function init()
 {
     // Check database connection
     if (Yii::app()->db === null) {
         throw new CHttpException(500, 'An active "db" connection is required to run this generator.');
     }
     // Check that reset button has been pressed
     if (isset($_POST['reset'])) {
         $this->resetGenerator();
     }
     // Refresh element name from session variable if on second pass
     if (isset(Yii::app()->session['elementName'])) {
         $this->elementName = Yii::app()->session['elementName'];
     } else {
         $this->elementName = "";
     }
     // Refresh table name from session variable if on second pass
     if (isset(Yii::app()->session['tableName'])) {
         $this->tableName = Yii::app()->session['tableName'];
         $this->modelClass = $this->generateClassName($this->tableName);
     } else {
         $this->tableName = "";
     }
     // Set default variables
     $this->elementFields = "'value' => 'string',";
     $this->controllerClass = $this->generateControllerName($this->modelClass);
     $this->baseControllerClass = 'Controller';
     $this->modelPath = 'application.models.elements';
     $this->baseClass = 'BaseElement';
     $this->ignore = array('id', 'event_id', 'created_user_id', 'created_date', 'last_modified_user_id', 'last_modified_date');
     $this->migrationPath = 'application.migrations';
     $this->authorName = Yii::app()->params['authorName'];
     $this->authorEmail = Yii::app()->params['authorEmail'];
     // Set progress level
     if (isset(Yii::app()->session['level'])) {
         $this->level = Yii::app()->session['level'];
     } else {
         $this->level = self::CREATE_MIGRATION;
     }
     parent::init();
 }
開發者ID:code-4-england,項目名稱:OpenEyes,代碼行數:44,代碼來源:ElementCode.php


注:本文中的CCodeModel::init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。