/** * Constructor. * * Supported params for $config are: * - db = user-supplied instance of database connector, * or key name of registry instance. * - name = table name. * - primary = string or array of primary key(s). * - rowClass = row class name. * - rowsetClass = rowset class name. * - referenceMap = array structure to declare relationship * to parent tables. * - dependentTables = array of child tables. * - metadataCache = cache for information from adapter describeTable(). * * @param mixed $config Array of user-specified config options, or just the Db Adapter. * @return void */ public function __construct($config = array()) { if (is_null(self::getDefaultAdapter())) { $config_db = Zood_Config::get('db'); $config_db_option = $config_db['default']; $dbAdapter = Zend_Db::factory($config_db_option['adapter'], $config_db_option); self::setDefaultAdapter($dbAdapter); } parent::__construct($config); }
/** * Get instance * * @param string $name * @param array $config * @return Zend_Cache_Core|Zend_Cache_Frontend */ public static function getInstance($name = 'default', $config = NULL) { if (isset(self::$_instances[$name])) { return self::$_instances[$name]; } if (!is_null($config)) { $config = array_merge(Zood_Config::get('cache/' . $name), $config); } else { $config = Zood_Config::get('cache/' . $name); } self::$_instances[$name] = self::factory($config['frontend'], $config['backend'], $config['frontendOption'], $config['backendOption']); return self::$_instances[$name]; }
/** * Process result data controller action returned * * @param array $rs * @param Zood_Controller_Action $action */ public function process(array $rs, Zood_Controller_Action $action) { $this->setData($action->getData()); $scriptPath = $this->getScriptPath(); if (empty($scriptPath)) { /** Zood_Config */ require_once 'Zood/Config.php'; $viewConfig = Zood_Config::get('view'); if (isset($viewConfig['script_path'])) { $scriptPath = $viewConfig['script_path']; $this->setScriptPath($scriptPath); } } $script = $this->getScript($rs['resource']); $this->render($script); }