/** * Constructor * * @param JDatabase &$db A database connector object * * @throws UnexpectedValueException */ public function __construct(&$db) { $this->_tableName = 'extension'; $this->_tbl_key = 'rctranslations_id'; $table = RedcoreHelpersTranslation::getTranslationTable(); $this->_tbl = RTranslationTable::getTranslationsTableName($table->table, ''); $this->_tableName = str_replace('#__', '', $this->_tbl); if (empty($this->_tbl) || empty($this->_tbl_key) && empty($this->_tbl_keys)) { throw new UnexpectedValueException(sprintf('Missing data to initialize %s table | id: %s', $this->_tbl, $this->_tbl_key)); } parent::__construct($db); // Initialise custom fields $this->loadCustomFields(); }
/** * Object constructor to set table and key fields. In most cases this will * be overridden by child classes to explicitly set the table and key fields * for a particular database table. * * @param string $table Name of the table to model. * @param mixed $key Name of the primary key field in the table or array of field names that compose the primary key. * @param JDatabaseDriver $db JDatabaseDriver object. * * @since 11.1 */ public function __construct($table, $key, $db) { $this->_tableName = $table; if (is_array($key)) { $this->_tbl_keys = $key; $this->_tbl_key = $key; $this->_tableKey = $key[key($key)]; } else { $this->_tbl_key = $key; $this->_tableKey = $key; } // Set all columns from table as properties $columns = array(); $dbColumns = $db->getTableColumns('#__' . $table, false); if (count($dbColumns) > 0) { foreach ($dbColumns as $columnKey => $columnValue) { $columns[$columnValue->Field] = $columnValue->Default; } $this->setProperties($columns); } parent::__construct($db); }
/** * Constructor * * @param JDatabase &$db A database connector object * * @throws UnexpectedValueException */ public function __construct(&$db) { $this->_tableName = 'redcore_webservices'; parent::__construct($db); }
/** * Constructor * * @param JDatabase &$db A database connector object * * @throws UnexpectedValueException */ public function __construct(&$db) { $this->_tableName = 'redcore_payment_log'; $this->_tbl_key = 'id'; parent::__construct($db); }
/** * Constructor * * @param JDatabase &$db A database connector object * * @throws UnexpectedValueException */ public function __construct(&$db) { $this->_tableName = 'redcore_oauth_clients'; $this->_tbl_key = 'id'; parent::__construct($db); }