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();
?>

Yii dynamic database url manager

After a long research and banging my head against the wall several nights I finally found a way to use Yii the way I wanted. First I wanted a way to read from the database SEO friendly URLs and if any founded call a particular pair of controller and action. If no SEO friendly URL is found I want to default to some basic Yii url manager rules. Last case is handled by default by Yii php framework by throwing a 404 in case nothing is found.

I shall explain step by step how to get this working.