/** * Returns an instance of Oray_Db_Helper * * Singleton pattern implementation * * @return Oray_Db_Helper Provides a fluent interface */ public static function getInstance() { if (null === self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
/** * @param mixed $db Either an Adapter object, or a string naming a Registry key * @return Zend_Db_Adapter_Abstract * @throws Oray_Dao_Exception */ protected static function _setupAdapter($db) { if ($db === null) { return null; } if (is_string($db)) { require_once 'Oray/Db/Helper.php'; $db = Oray_Db_Helper::get($db); } if (!$db instanceof Zend_Db_Adapter_Abstract) { require_once 'Oray/Dao/Exception.php'; throw new Oray_Dao_Exception('Argument must be of type Zend_Db_Adapter_Abstract, or a Registry key where a Oray_Db_Helper object is stored'); } return $db; }