Constants

DEFAULT_CONNECTION_NAME

DEFAULT_CONNECTION_NAME

Default connection name

Properties

$modelPath

$modelPath : string

Path to Tick model directory

Type

string — Tick root directory

$connections

$connections : array

List of all defined connections by name

Type

array

Methods

getStorage()

getStorage(string  $connectionName = self::DEFAULT_CONNECTION_NAME) : \Localgod\Tick\Storage\Storage

Get storage instance

Parameters

string $connectionName

Name of connection

Throws

\RuntimeException

if the storage could not be retrived

Returns

\Localgod\Tick\Storage\Storage

getDatabaseName()

getDatabaseName(string  $connectionName = self::DEFAULT_CONNECTION_NAME) : string

Get name of current database

Parameters

string $connectionName

Name of connection

Returns

string

getModelPath()

getModelPath() : string

Get model path

Returns

string

setModelPath()

setModelPath(string  $path) : void

Set model path

Parameters

string $path

Math to models

Throws

\InvalidArgumentException

on non existing path

addDefaultConnectionConfig()

addDefaultConnectionConfig(string  $type, string  $database, string  $username = null, string  $password = null, string  $host = '127.0.0.1', integer  $port = null, array  $driver_options = null) : void

Set the default database connection

Parameters

string $type

Pdo supported sql databases or mongodb

string $database

The database name

string $username

Username

string $password

Password

string $host

The host name of the data source

integer $port

The the port of the data source

array $driver_options

Driver options

Throws

\InvalidArgumentException

missing database driver or database name

addConnectionConfig()

addConnectionConfig(string  $name, string  $type, string  $database, string  $username = null, string  $password = null, string  $host = '127.0.0.1', integer  $port = null, array  $driverOptions = null) : void

Set the database connection

Parameters

string $name

Connection name for later retrieval

string $type

Pdo supported sql databases or mongodb

string $database

The database name

string $username

Username

string $password

Password

string $host

The host name of the data source

integer $port

The the port of the data source

array $driverOptions

Driver options

Throws

\InvalidArgumentException

missing database driver or database name

removeAllConnections()

removeAllConnections() : void

Closes and removes all connections

removeConnectionConfig()

removeConnectionConfig(string  $connectionName = self::DEFAULT_CONNECTION_NAME) : void

Closes and removes the a connection

Parameters

string $connectionName

Connection name

getUniqueName()

getUniqueName(string  $connectionName) : string

The unigue name of connection in $GLOBALS

Parameters

string $connectionName

Connection name

Returns

string —

unique name

createSqlStorage()

createSqlStorage(string  $connectionName = self::DEFAULT_CONNECTION_NAME) : void

Create sql storage

Parameters

string $connectionName

Name of connection

Throws

\RuntimeException

if connection creation failed

createMongoStorage()

createMongoStorage(string  $connectionName = self::DEFAULT_CONNECTION_NAME) : void

Create mongo storage

Parameters

string $connectionName

name of connection

Throws

\RuntimeException

if connection creation failed

createSolrStorage()

createSolrStorage(string  $connectionName = self::DEFAULT_CONNECTION_NAME) : void

Create SOLR storage

Parameters

string $connectionName

name of connection

Throws

\RuntimeException

if connection creation failed