• Full name: \App\Infrastructure\Persistence\NativePdoDatabase
  • Parent class: QueryBuilder
  • This class is marked as final and can't be subclassed
  • This class is a Final class

Constants

Constant Visibility Type Value
SCOPE_ALL private 'all'
SCOPE_SITE private 'site'
SCOPE_GLOBAL private 'global'
SCOPE_MS_GLOBAL private 'ms_global'

Properties

connectionType

protected ?string $connectionType

sitePrefix

public string $sitePrefix

basePrefix

public string $basePrefix

prefix

public string $prefix

siteKey

public ?string $siteKey

siteTables

public list<string> $siteTables

globalTables

public list<string> $globalTables

msGlobalTables

public list<string> $msGlobalTables

option

public string $option

plugin

public string $plugin

content

public string $content

contenttype

public string $contenttype

site

public string $site

user

public string $user

site_user

public string $site_user

product

public string $product

elfinder_file

public string $elfinder_file

elfinder_trash

public string $elfinder_trash

event_store

public string $event_store

pages

public string $pages

page_translations

public string $page_translations

settings

public string $settings

uploads

public string $uploads

connection

protected \Qubus\Expressive\Connection $connection

configContainer

protected \Qubus\Config\ConfigContainer $configContainer

Methods

__construct

public __construct(\Qubus\Expressive\Connection $connection, \Qubus\Config\ConfigContainer $configContainer): mixed

Parameters:

Parameter Type Description
$connection \Qubus\Expressive\Connection
$configContainer \Qubus\Config\ConfigContainer

Throws:


setPrefix

Sets the table prefix for Devflow tables.

public setPrefix(?string $prefix = null, bool $setTableNames = true): string|\Qubus\Error\Error

Parameters:

Parameter Type Description
$prefix ?string Alphanumeric name for the new prefix.
$setTableNames bool Optional. Whether the table names, e.g. Database::$content, should be updated or not.

Return Value:

Old prefix or Error on error

Throws:


setSiteKey

Sets site key.

public setSiteKey(string $siteKey): string

Parameters:

Parameter Type Description
$siteKey string Site id to use.

Return Value:

Previous site id.

Throws:


getSitePrefix

Gets site prefix.

public getSitePrefix(string|null $siteKey = null): string

Parameters:

Parameter Type Description
$siteKey string|null Optional.

Return Value:

Site prefix.

Throws:


tables

Returns an array of Devflow tables.

public tables(string $scope = \self::SCOPE_ALL, bool $prefix = true, string|null $siteKey = null): string[]

The scope argument can take one of the following:

'all' - return all the 'global' and 'site' tables. 'site' - returns the site level tables. 'global' - returns global tables. 'ms_global' - returns multisite global tables.

Parameters:

Parameter Type Description
$scope string (Optional) Can be all, site, global or ms_global. Default: all.
$prefix bool (Optional) Whether to include table prefixes. Default: true.
$siteKey string|null (Optional) The siteKey to prefix. Default: Database::siteKey

Return Value:

Table names.

Throws:


forSite

Useful when you want $db->forSite('site_2_')->option.

public forSite(?string $siteKey): self

Parameters:

Parameter Type Description
$siteKey ?string

Throws:


refreshTableNames

private refreshTableNames(): void

Throws:


resolveSitePrefix

private resolveSitePrefix(?string $siteKey = null): string

Parameters:

Parameter Type Description
$siteKey ?string

Throws:


allTables

private allTables(): list<string>

Throws:


globalScopedTables

private globalScopedTables(): list<string>

Throws:


assertValidPrefix

private assertValidPrefix(string $prefix): void

Parameters:

Parameter Type Description
$prefix string

Throws: