mirror of
https://github.com/yiisoft/yii.git
synced 2026-03-15 04:26:52 +01:00
This commit is contained in:
@@ -53,9 +53,18 @@ class ModelCode extends CCodeModel
|
||||
$this->files=array();
|
||||
$templatePath=$this->templatePath;
|
||||
|
||||
$params=array(
|
||||
'tableName'=>$this->removePrefix($this->tableName),
|
||||
'modelClass'=>$this->modelClass,
|
||||
'columns'=>$this->getColumns(),
|
||||
'labels'=>$this->getLabels(),
|
||||
'rules'=>$this->getRules(),
|
||||
'relations'=>$this->getRelations(),
|
||||
);
|
||||
|
||||
$this->files[]=new CCodeFile(
|
||||
Yii::getPathOfAlias($this->modelPath).'/'.$this->modelClass.'.php',
|
||||
$this->render($templatePath.'/model.php')
|
||||
$this->render($templatePath.'/model.php', $params)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -161,11 +170,6 @@ class ModelCode extends CCodeModel
|
||||
return isset($relations[$this->modelClass]) ? $relations[$this->modelClass] : array();
|
||||
}
|
||||
|
||||
public function getTableNameWithoutPrefix()
|
||||
{
|
||||
return $this->removePrefix($this->tableName);
|
||||
}
|
||||
|
||||
protected function removePrefix($tableName,$addBrackets=true)
|
||||
{
|
||||
$prefix=$this->tablePrefix!='' ? $this->tablePrefix : Yii::app()->db->tablePrefix;
|
||||
|
||||
Reference in New Issue
Block a user