Master / Slave switch in the Zend Framework application layer

前端 未结 3 2010
忘了有多久
忘了有多久 2021-01-02 18:24

I am writing an application which requires the Master/Slave switch to happen inside the application layer. As it is right now, I instantiate a Zend_Db_Table object on creati

3条回答
  •  猫巷女王i
    2021-01-02 18:36

    How about something like a base class that you extend which performs the startup?

    class My_Db_Table extends Zend_Db_Table
    {
        function init() 
        {
            if (....) {
               // set the default adaptor to the write-DB-master
            }
            parent::init();
        }
    }
    // all your models then extend My_Db_Table instead of Zend_Db_Table
    

提交回复
热议问题