开发者

how to set the table prefix in zend framework

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';
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜