I need to add a table prefix to zend framework configurations. But it seems really complicated开发者_如何学Python matter adding such a configuration (I have to add too many lines of code to do that). Is there a way to set the table prefix in a simple manner? (like other frameworks do). I'm using Zend Framework 1.11
if you use Zend_Db_Table_Abstract, you could extend this class like this:
class My_Db_Table_Abstract extends Zend_Db_Table_Abstract
{
protected function _setupTableName()
{
parent::_setupTableName();
$prefix = 'StackOverflow'; // maybe from config..
$this->_name = $prefix . '_' . $this->_name;
}
}
class User extends My_Db_Table_Abstract
{
$this->_name = 'user';
}
精彩评论