/** * setUpBeforeClass * * @return void */ public static function setUpBeforeClass() { parent::setUpBeforeClass(); if (static::$dbo) { AbstractDatabaseAdapter::setInstance(new WindwalkerAdapter(static::$dbo)); } }
/** * Constructor. * * @param string $alias Table alias. * @param string $table Table name. * @param string|array $pk Primary key. * @param DatabaseAdapterInterface $db Database adapter. */ public function __construct($alias, $table, $pk = 'id', DatabaseAdapterInterface $db = null) { $this->db = $db ?: AbstractDatabaseAdapter::getInstance(); $this->pk = $pk ?: $alias . '.' . $pk; $this->tables = new DataSet(); $this->addTable($alias, $table); $this->prepare(); }
/** * Get table fields. * * @param string $table Table name. * * @return array */ protected function getFields($table = null) { $table = $table ?: $this->table; return $this->db->getFields($table); }
/** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return Container Returns itself to support chaining. * * @since 1.0 */ public function register(Container $container) { AbstractDatabaseAdapter::setInstance(new JoomlaAdapter($container->get('db'))); }