From 9f5ffe8fc57ea3dc7a1f7110942a4ef525172fdb Mon Sep 17 00:00:00 2001 From: "qiang.xue" Date: Sun, 1 Nov 2009 12:07:31 +0000 Subject: [PATCH] (Fixes issue 659) --- framework/cli/commands/shell/ModelCommand.php | 3 +++ 1 file changed, 3 insertions(+) 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,