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().
public __construct ( mixed $config = [] ) : void | ||
$config | mixed | Array of user-specified config options, or just the Db Adapter. |
return | void |
public function __construct($config = null) { if (isset($this->_use_adapter)) { $config = $this->_use_adapter; } return parent::__construct($config); }
public function __construct($config = array()) { parent::__construct($config); if (!$this->_cache || $this->_cache === TRUE) { $this->_cache = CachePlugin::init(); } }
public function __construct() { $this->_config = Zend_Registry::get('config'); $this->_cache = Zend_Registry::get('cache'); $this->_auth = Zend_Registry::get('auth'); parent::__construct(); }
/** * __construct() - For concrete implementation of Zend_Db_Table * * @param string|array $config string can reference a Zend_Registry key for a db adapter * OR it can reference the name of a table * @param array|Zend_Db_Table_Definition $definition */ public function __construct($config = array(), $definition = null) { if ($definition !== null && is_array($definition)) { $definition = new Zend_Db_Table_Definition($definition); } if (is_string($config)) { if (Zend_Registry::isRegistered($config)) { trigger_error(__CLASS__ . '::' . __METHOD__ . '(\'registryName\') is not valid usage of Zend_Db_Table, ' . 'try extending Zend_Db_Table_Abstract in your extending classes.', E_USER_NOTICE ); $config = array(self::ADAPTER => $config); } else { // process this as table with or without a definition if ($definition instanceof Zend_Db_Table_Definition && $definition->hasTableConfig($config)) { // this will have DEFINITION_CONFIG_NAME & DEFINITION $config = $definition->getTableConfig($config); } else { $config = array(self::NAME => $config); } } } parent::__construct($config); }
public function __construct() { if (isset($this->_use_adapter)) { $config = Zend_Registry::get($this->_use_adapter); } return parent::__construct($config); }
public function __construct($config = NULL) { parent::__construct($config); if (!$this->table_exists()) { $this->create_table(); } }
/** Construct the objects * @access public */ public function __construct() { $this->_config = Zend_Registry::get('config'); $this->_cache = Zend_Registry::get('cache'); $this->_auth = Zend_Registry::get('auth'); $this->_user = new Pas_User_Details(); parent::__construct(); }
/** * Constructor * * @param array $config * @param array $filters */ public function __construct(array $config = array(), array $filters = array()) { parent::__construct($config); $this->_db = $config['db']; $this->_table = $config['name']; $this->_parentField = $config['primary'][0]; $this->_filters = $filters; }
function App_Db_Table_Abstract($config = null) { if (isset($this->_use_adapter)) { $dbAdapters = Zend_Registry::get('dbAdapters'); $config = $dbAdapters[$this->_use_adapter]; } return parent::__construct($config); }
function Kutu_Core_Orm_CoreDb($config = null) { if (isset($this->_use_adapter)) { $dbAdapters = Zend_Registry::get('dbAdapters'); $config = $dbAdapters[$this->_use_adapter]; } return parent::__construct($config); }
public function __construct() { // Create new PHPExcel object $this->objPHPExcel = new PHPExcel(); // Set properties $this->objPHPExcel->getProperties()->setCreator("Resolvo")->setLastModifiedBy("Maarten Balliauw")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file"); parent::__construct(); }
/** * __construct * * Content constructor. * * @param integer $id Content id value. */ public function __construct($id = -1) { parent::__construct(); $this->_id = $id; if ($id != -1) { $this->_data = $this->find((int) $id)->current(); } // end if }
public function __construct($config = array()) { $this->_config = Zend_Registry::get('config'); $this->_log = Zend_Registry::get('log'); $this->_prefix = $this->_name . '_'; $this->_db = $this->getAdapter(); //$this->_cache = Zend_Registry::get('cache'); parent::__construct($config); }
public function __construct($config = array()) { parent::__construct($config); $this->_cache = Digitalus_Cache_Manager::getInstance(); /** * @var Digitalus_Db_Cache */ $this->cache = new Digitalus_Db_Cache($this); }
/** * In addition to regular constructor, remove cascading write operations performed by Zend_Db_Table*, * if the DB already supports DRI (see notes for "db.DRI" in config/config.ini). */ public function __construct(array $config = array()) { parent::__construct($config); $registry = Zend_Registry::getInstance(); // if DB supports DRI, disable cascading deletes within Zend_Db_Table* if ($registry['config']->db->DRI) { unset($this->_referenceMap['Post']['onDelete']); } }
public function __construct($config = array()) { if (is_string($config)) { $this->_name = $config; $config = array(); } parent::__construct($config); $this->_status = $this->status(); }
/** * 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); }
/** * Constructor. * * @return void */ public function __construct() { $config = array('db' => Phprojekt::getInstance()->getDb()); $file = Phprojekt::getInstance()->getConfig()->searchStopwordList; if (file_exists($file)) { $tmp = file_get_contents($file); $this->_stopWords = $this->_stringToArray($tmp); } parent::__construct($config); }
/** * Constructor, user must provide Application's ID */ public function __construct() { $register = Zend_Registry::getInstance(); $dbConnector = $register->get("db"); $dbConfig = $dbConnector->getConfig(); $dbSchema = array(); $dbSchema["db"] = $dbConnector; $dbSchema["schema"] = $dbConfig["dbname"]; parent::__construct($dbSchema); }
/** * 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 (!isset($config['rowClass'])) { // Set a classname to be the name of the table class minus the last part // e.g. Content_Node_Factory becomes Content_Node $rowclass = substr(get_class($this), 0, strrpos(get_class($this), "_")); if (class_exists($rowclass)) { $config['rowClass'] = $rowclass; } } parent::__construct($config); }
public function __construct($options = array()) { if (isset($options['rowClass'])) { $rowClass = $options['rowClass']; } else { $rowClass = 'Core_Model_Db_Table_Row'; } parent::__construct(array_merge($options, array('db' => 'db', 'rowsetClass' => 'Siberian_Db_Table_Rowset', 'rowClass' => $rowClass))); if (isset($options['modelClass'])) { $this->_modelClass = $options['modelClass']; } }
public function __construct($config = array()) { if ($config instanceof Zend_Config) { $config = $config->toArray(); } foreach ($config as $key => $value) { if ($key == 'order') { $this->_order = $value; } elseif (substr($key, -6) == 'Column') { $this->_colums[substr($key, 0, -6)] = $value; } } parent::__construct($config); }
/** * Constructor * * @param array $config */ public function __construct(array $config = array()) { parent::__construct($config); $this->_db = $config['db']; $this->_table = $config['name']; $this->_idField = $config['primary']; $front = Zend_Controller_Front::getInstance(); $this->_request = $front->getRequest(); $this->_config = Zend_Registry::get('config'); // Получим обьект сериализатора $this->_serializer = Zend_Serializer::factory('PhpSerialize'); // Получим обьекты для логирования $this->_logMsg = Zend_Registry::get('Zend_Log'); $this->_logStat = Zend_Registry::get('Zend_LogStat'); $this->_logEx = Zend_Registry::get('Zend_LogEx'); }
public function __construct() { //FECHANDO A CONEXAO EXISTENTE JA QUE UMA NOVA SERA ABERTA $db = Zend_Db_Table::getDefaultAdapter(); if (!empty($db)) { $db->closeConnection(); unset($db); } if (!$this->_config instanceof Zend_Config_Ini) { $this->_config = new Zend_Config_Ini(Zend_Registry::get('DIR_CONFIG'), 'conexao_' . strtolower($this->_banco), array('allowModifications' => true)); Zend_Registry::getInstance()->set('config', $this->_config); Zend_Db_Table::setDefaultAdapter(Zend_Db::factory($this->_config->db)); parent::__construct(); //Setar o campo texto maior que 4096 caracteres aceitaveis por padr?o no PHP $this->_db->query('SET TEXTSIZE 2147483647'); } }
public function __construct($config = array()) { // initialise the DB // get the db and revision number $db = Pimcore_Resource_Mysql::get(); $rev = Pimcore_Version::$revision; // older versions return the resource if ($rev > 1350) { Zend_Db_Table::setDefaultAdapter($db->getResource()); } else { Zend_Db_Table::setDefaultAdapter($db); } // set the params $this->_name = 'plugin_groupdocs'; $this->_primary = 'id'; parent::__construct($config); }
/** * Constructeur de classe. * * @param string $sTable : nom de la table. * @param string|array $pPrimary : clé(s) primaire(s) (nom du champ) * @param string $sRowClass : nom de la classe personnalisee pour les Row * @param string $sRowsetClass : nom de la classe personnalisee pour les Rowset */ public function __construct($sTable, $pPrimary = 'ID', $sRowClass = 'Projet_Db_Row', $sRowsetClass = 'Projet_Db_Rowset') { try { $this->_name = $sTable; $this->_primary = $pPrimary; // Construction de l'accès à la base de données parent::__construct(array()); //Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('db')); $this->setRowClass($sRowClass); $this->setRowsetClass($sRowsetClass); // Initialise la séquence $this->_sequence = $this->_name . "_" . $this->_primary . "_SEQ"; // Récupération de l'adapteur à la base. $this->oAdapter = $this->getAdapter(); } catch (Exception $e) { throw new Zend_Exception("BAD_ACCESS", __METHOD__, $e); } }
public function __construct($config = array()) { parent::__construct($config); $this->_logger = Zend_Registry::get('logger'); $this->_db = $this->getAdapter(); try { $names = Zend_Registry::get('DZend_Db_Table::_name'); } catch (Zend_Exception $e) { $names = array(); } $className = get_class($this); if (!array_key_exists($className, $names)) { $names[$className] = $this->camelToUnderscore(preg_replace('/^DbTable_/', '', get_class($this))); Zend_Registry::set('DZend_Db_Table::_name', $names); } $this->_name = $names[$className]; // Its set by default to be get_class($this), by Zend. $this->_rowClass = isset($this->_rowClass) ? $this->_rowClass : get_class($this) . 'Row'; }
public function __construct($config = array()) { if (!is_array($config)) { $config = array(); } require_once 'Zend/Registry.php'; if (!isset($config[self::ADAPTER]) && Zend_Registry::isRegistered('indexDb')) { $config[self::ADAPTER] = Zend_Registry::get('indexDb'); } if (!isset($config[self::ADAPTER]) && Zend_Registry::isRegistered('config')) { $c = Zend_Registry::get('config'); require_once 'Zend/Db.php'; $config[self::ADAPTER] = Zend_Db::factory($c['indexDb']['adapter'], $c['indexDb']['params']); Zend_Registry::set('indexDb', $config[self::ADAPTER]); } parent::__construct($config); }
/** * Constructor * * $config is an instance of Zend_Config or an array of key/value pairs containing configuration options for * Zend_Session_SaveHandler_DbTable and Zend_Db_Table_Abstract. These are the configuration options for * Zend_Session_SaveHandler_DbTable: * * primaryAssignment => (string|array) Session table primary key value assignment * (optional; default: 1 => sessionId) You have to assign a value to each primary key of your session table. * The value of this configuration option is either a string if you have only one primary key or an array if * you have multiple primary keys. The array consists of numeric keys starting at 1 and string values. There * are some values which will be replaced by session information: * * sessionId => The id of the current session * sessionName => The name of the current session * sessionSavePath => The save path of the current session * * NOTE: One of your assignments MUST contain 'sessionId' as value! * * modifiedColumn => (string) Session table last modification time column * * lifetimeColumn => (string) Session table lifetime column * * dataColumn => (string) Session table data column * * lifetime => (integer) Session lifetime (optional; default: ini_get('session.gc_maxlifetime')) * * overrideLifetime => (boolean) Whether or not the lifetime of an existing session should be overridden * (optional; default: false) * * @param Zend_Config|array $config User-provided configuration * @return void * @throws Zend_Session_SaveHandler_Exception */ public function __construct($config) { if ($config instanceof Zend_Config) { $config = $config->toArray(); } else { if (!is_array($config)) { /** * @see Zend_Session_SaveHandler_Exception */ require_once 'Zend/Session/SaveHandler/Exception.php'; throw new Zend_Session_SaveHandler_Exception('$config must be an instance of Zend_Config or array of key/value pairs containing ' . 'configuration options for Zend_Session_SaveHandler_DbTable and Zend_Db_Table_Abstract.'); } } foreach ($config as $key => $value) { do { switch ($key) { case self::PRIMARY_ASSIGNMENT: $this->_primaryAssignment = $value; break; case self::MODIFIED_COLUMN: $this->_modifiedColumn = (string) $value; break; case self::LIFETIME_COLUMN: $this->_lifetimeColumn = (string) $value; break; case self::DATA_COLUMN: $this->_dataColumn = (string) $value; break; case self::LIFETIME: $this->setLifetime($value); break; case self::OVERRIDE_LIFETIME: $this->setOverrideLifetime($value); break; default: // unrecognized options passed to parent::__construct() break 2; } unset($config[$key]); } while (false); } parent::__construct($config); }
public function __construct() { $this->_db = Zend_Registry::get('dbcardio'); parent::__construct(); }