PHP Класс ElementCode

Наследование: extends CCodeModel
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$authorEmail
$authorName
$baseClass
$baseControllerClass
$controllerClass
$elementFields
$elementName Properties
$ignore
$level
$migrationPath
$modelClass
$modelPath
$tableName
$tableSchema

Открытые методы

Метод Описание
attributeLabels ( ) : array Attribute labels.
checkColumns ( $table ) * Check that all database field names conform to PHP variable naming rules For example mysql allows field name like "2011aa", but PHP does not allow variables like "$model->2011aa"
confirmed ( CCodeFile $file ) : boolean Checks to determine whether file should be saved.
generateActiveField ( string $modelClass, string $column ) : string Generates an appropriate input field for _form view.
generateActiveLabel ( string $modelClass, string $column ) : string Generates an appropriate label for a field of the element.
generateLabels ( CDbTableSchema $table ) : array Generates labels for fields of the table.
generateRules ( CDbTableSchema $table ) : array Generates rules for the table.
getTableSchema ( $tableName ) * Gets schema for passed tableName
init ( ) Runs on object initiation.
prepare ( ) * Run on form submission by preview or generate buttons. Generates the list of files and code
renderResults ( ) : string Write results and run migration scripts.
requiredTemplates ( ) : array List of templates that must be present.
resetGenerator ( ) * Resets all session variables to allow restart in case of error
resetTimeStamps ( ) Reset the time stamps.
rules ( ) Validation rules.
save ( ) : boolean Saves the generated views code into files NB Ensure _www has write permissions for elements directory.
successMessage ( ) * Returns a success message
validateBaseClass ( $attribute, array $params ) Validation method for base class.
validateElementFields ( $attribute, array $params ) Validation method for elementFields.
validateModelClass ( $attribute, array $params ) Validation method for model class and associated table.
validateModelPath ( $attribute, array $params ) Validation method for model path.
validateTableName ( $attribute, array $params ) Validation method for table name and model class.

Защищенные методы

Метод Описание
createTimeStamp ( $description ) Creates time stamp in format expected for ./yiic migrate Stores in a session variable, otherwise time stamp changes on each second call.
generateClassName ( $tableName ) * Generates Yii style class name from table name
generateControllerName ( $modelClass ) * Generates Yii style controller name from class name
generateMigrationName ( $description, $tableName ) Generates a time stamped migration file name in format expected by ./yiic migrate.

Описание методов

attributeLabels() публичный Метод

Attribute labels.
public attributeLabels ( ) : array
Результат array

checkColumns() публичный Метод

* Check that all database field names conform to PHP variable naming rules For example mysql allows field name like "2011aa", but PHP does not allow variables like "$model->2011aa"
public checkColumns ( $table )
$table the table schema object

confirmed() публичный Метод

Checks to determine whether file should be saved.
public confirmed ( CCodeFile $file ) : boolean
$file CCodeFile The file to be saved
Результат boolean Whether the code file should be saved

createTimeStamp() защищенный Метод

Creates time stamp in format expected for ./yiic migrate Stores in a session variable, otherwise time stamp changes on each second call.
protected createTimeStamp ( $description )

generateActiveField() публичный Метод

Generates an appropriate input field for _form view.
public generateActiveField ( string $modelClass, string $column ) : string
$modelClass string Name of the element's model class
$column string Name of a table colum
Результат string A form input element

generateActiveLabel() публичный Метод

Generates an appropriate label for a field of the element.
public generateActiveLabel ( string $modelClass, string $column ) : string
$modelClass string Name of the element's model class
$column string Name of a table colum
Результат string A label

generateClassName() защищенный Метод

* Generates Yii style class name from table name
protected generateClassName ( $tableName )
$tableName Name of the table

generateControllerName() защищенный Метод

* Generates Yii style controller name from class name
protected generateControllerName ( $modelClass )
$modelClass Name of the table

generateLabels() публичный Метод

Generates labels for fields of the table.
public generateLabels ( CDbTableSchema $table ) : array
$table CDbTableSchema A table
Результат array Array containing the labels

generateMigrationName() защищенный Метод

Generates a time stamped migration file name in format expected by ./yiic migrate.
protected generateMigrationName ( $description, $tableName )

generateRules() публичный Метод

Generates rules for the table.
public generateRules ( CDbTableSchema $table ) : array
$table CDbTableSchema A table
Результат array Array of rules

getTableSchema() публичный Метод

* Gets schema for passed tableName
public getTableSchema ( $tableName )
$tableName Name of table

init() публичный Метод

Runs on object initiation.
public init ( )

prepare() публичный Метод

* Run on form submission by preview or generate buttons. Generates the list of files and code
public prepare ( )

renderResults() публичный Метод

Write results and run migration scripts.
public renderResults ( ) : string
Результат string the code generation result log.

requiredTemplates() публичный Метод

List of templates that must be present.
public requiredTemplates ( ) : array
Результат array

resetGenerator() публичный Метод

* Resets all session variables to allow restart in case of error
public resetGenerator ( )

resetTimeStamps() публичный Метод

Reset the time stamps.
public resetTimeStamps ( )

rules() публичный Метод

Validation rules.
public rules ( )

save() публичный Метод

Saves the generated views code into files NB Ensure _www has write permissions for elements directory.
public save ( ) : boolean
Результат boolean True if save is successful

successMessage() публичный Метод

* Returns a success message
public successMessage ( )

validateBaseClass() публичный Метод

Validation method for base class.
public validateBaseClass ( $attribute, array $params )
$params array Array of parameters

validateElementFields() публичный Метод

Validation method for elementFields.
public validateElementFields ( $attribute, array $params )
$params array Array of parameters

validateModelClass() публичный Метод

Validation method for model class and associated table.
public validateModelClass ( $attribute, array $params )
$params array Array of parameters

validateModelPath() публичный Метод

Validation method for model path.
public validateModelPath ( $attribute, array $params )
$params array Array of parameters

validateTableName() публичный Метод

Validation method for table name and model class.
public validateTableName ( $attribute, array $params )
$params array Array of parameters

Описание свойств

$authorEmail публичное свойство

public $authorEmail

$authorName публичное свойство

public $authorName

$baseClass публичное свойство

public $baseClass

$baseControllerClass публичное свойство

public $baseControllerClass

$controllerClass публичное свойство

public $controllerClass

$elementFields публичное свойство

public $elementFields

$elementName публичное свойство

Properties
public $elementName

$ignore публичное свойство

public $ignore

$level публичное свойство

public $level

$migrationPath публичное свойство

public $migrationPath

$modelClass публичное свойство

public $modelClass

$modelPath публичное свойство

public $modelPath

$tableName публичное свойство

public $tableName

$tableSchema публичное свойство

public $tableSchema