diff --git a/framework/gii/generators/model/ModelCode.php b/framework/gii/generators/model/ModelCode.php index a234c8eaf..44e02fa8f 100644 --- a/framework/gii/generators/model/ModelCode.php +++ b/framework/gii/generators/model/ModelCode.php @@ -144,7 +144,7 @@ class ModelCode extends CCodeModel /* * 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 variable liek "$model->2011aa" + * For example mysql allows field name like "2011aa", but PHP does not allow variable like "$model->2011aa" * @param CDbTableSchema $table the table schema object * @return string the invalid table column name. Null if no error. */ @@ -152,7 +152,7 @@ class ModelCode extends CCodeModel { foreach($table->columns as $column) { - if(!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/',$column->name)) + if(!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/',$column->name)) return $table->name.'.'.$column->name; } }