yii how to get table name
Create a rawTableName method in the model like this:
/**
* @return string the associated database raw table name
*/
public function rawTableName($full = true) {
return $full?str_replace('`', '', $this->tableSchema->rawName) : preg_replace('#[^a-z_]#i','',$this->tableName());
}
And in the view you can use this:
<?php print 'Model table name: '.$model->rawTableName(false); ?>
or
<?php print 'Model table name: '.$model->rawTableName(); ?>