Zend Framework - Database Table Singleton
- by Sonny
I have found myself doing this in my code to 'cache' the work done when instantiating my Zend_Db_Table models:
if (Zend_Registry::isRegistered('x_table')) {
$x_table = Zend_Registry::get('x_table');
} else {
$x_table = new Default_Model_DbTable_X;
Zend_Registry::set('x_table', $x_table);
}
It bothered me that this method isn't very…