diff --git a/framework/cli/commands/shell/ModelCommand.php b/framework/cli/commands/shell/ModelCommand.php index 1d579f062..d0b63b7e6 100644 --- a/framework/cli/commands/shell/ModelCommand.php +++ b/framework/cli/commands/shell/ModelCommand.php @@ -426,6 +426,9 @@ EOD; if(!is_file($source)) // fall back to default ones $source=YII_PATH.'/cli/views/shell/model/'.basename($source); + $tablePrefix=Yii::app()->getDb()->tablePrefix; + if($tablePrefix!='' && !strncmp($tableName,$tablePrefix,strlen($tablePrefix))) + $tableName='{{'.substr($tableName,strlen($tablePrefix)).'}}'; return $this->renderFile($source,array( 'className'=>$className, 'tableName'=>$tableName,