Constants

METADATA_ATTRIBUTES

METADATA_ATTRIBUTES = 0

METADATA_PRIMARY_KEY

METADATA_PRIMARY_KEY = 1

METADATA_AUTO_INCREMENT_KEY

METADATA_AUTO_INCREMENT_KEY = 3

METADATA_INT_TYPE_ATTRIBUTES

METADATA_INT_TYPE_ATTRIBUTES = 5

Properties

$poolManager

$poolManager : \ManaPHP\Pool\ManagerInterface

Type

\ManaPHP\Pool\ManagerInterface

$_context

$_context : \ManaPHP\Data\DbContext

Type

\ManaPHP\Data\DbContext

$alias

$alias : \ManaPHP\AliasInterface

Type

\ManaPHP\AliasInterface

$eventsManager

$eventsManager : \ManaPHP\Event\ManagerInterface

Type

\ManaPHP\Event\ManagerInterface

$logger

$logger : \ManaPHP\Logging\LoggerInterface

Type

\ManaPHP\Logging\LoggerInterface

$configure

$configure : \ManaPHP\Configuration\Configure

Type

\ManaPHP\Configuration\Configure

$settings

$settings : \ManaPHP\Configuration\SettingsInterface

Type

\ManaPHP\Configuration\SettingsInterface

$crypt

$crypt : \ManaPHP\Security\CryptInterface

Type

\ManaPHP\Security\CryptInterface

$identity

$identity : \ManaPHP\IdentityInterface

Type

\ManaPHP\IdentityInterface

$cache

$cache : \ManaPHP\Caching\CacheInterface

Type

\ManaPHP\Caching\CacheInterface

$httpClient

$httpClient : \ManaPHP\Http\ClientInterface

Type

\ManaPHP\Http\ClientInterface

$restClient

$restClient : \ManaPHP\Http\ClientInterface

Type

\ManaPHP\Http\ClientInterface

$db

$db : \ManaPHP\Data\DbInterface

Type

\ManaPHP\Data\DbInterface

$redisCache

$redisCache : \Redis|\ManaPHP\Data\RedisInterface

Type

\Redis|\ManaPHP\Data\RedisInterface

$redisDb

$redisDb : \Redis|\ManaPHP\Data\RedisInterface

Type

\Redis|\ManaPHP\Data\RedisInterface

$redisBroker

$redisBroker : \Redis|\ManaPHP\Data\RedisInterface

Type

\Redis|\ManaPHP\Data\RedisInterface

$mongodb

$mongodb : \ManaPHP\Data\MongodbInterface

Type

\ManaPHP\Data\MongodbInterface

$rabbitmq

$rabbitmq : \ManaPHP\Messaging\AmqpInterface

Type

\ManaPHP\Messaging\AmqpInterface

$elasticsearch

$elasticsearch : \Elasticsearch\Client

Type

\Elasticsearch\Client

$mailer

$mailer : \ManaPHP\Mailing\MailerInterface

Type

\ManaPHP\Mailing\MailerInterface

$bosClient

$bosClient : \ManaPHP\Bos\ClientInterface

Type

\ManaPHP\Bos\ClientInterface

$wspClient

$wspClient : \ManaPHP\Ws\Pushing\ClientInterface

Type

\ManaPHP\Ws\Pushing\ClientInterface

$coroutineManager

$coroutineManager : \ManaPHP\Coroutine\ManagerInterface

Type

\ManaPHP\Coroutine\ManagerInterface

$wsClient

$wsClient : \ManaPHP\Ws\ClientInterface

Type

\ManaPHP\Ws\ClientInterface

$pubSub

$pubSub : \ManaPHP\Messaging\PubSubInterface

Type

\ManaPHP\Messaging\PubSubInterface

$_context

$_context : \object

Type

\object

$_di

$_di : \ManaPHP\DiInterface

Type

\ManaPHP\DiInterface

$_object_id

$_object_id : integer

Type

integer

$_on

$_on : array<mixed,callable>

Type

array<mixed,callable>

$_injections

$_injections : array

Type

array

$_url

$_url : string

Type

string

$_prefix

$_prefix : string

Type

string

$_has_slave

$_has_slave : boolean

Type

boolean

$_timeout

$_timeout : float

Type

float

$_pool_size

$_pool_size : string

Type

string

Methods

getInstance()

getInstance(string  $class, array  $params = array()) : mixed

Parameters

string $class
array $params

Returns

mixed

getShared()

getShared(string  $name) : mixed

Parameters

string $name

Returns

mixed

inject()

inject(string  $name, mixed  $target) : static

Parameters

string $name
mixed $target

Returns

static

__get()

__get(string  $name) : mixed

Magic method __get

Parameters

string $name

Returns

mixed

__set()

__set(string  $name, mixed  $value) : void

Parameters

string $name
mixed $value

__isset()

__isset(string  $name) : boolean

Parameters

string $name

Returns

boolean

attachEvent()

attachEvent(string  $event, callable  $handler, boolean  $appended = true) : static

Attach a listener to the events manager

Parameters

string $event
callable $handler
boolean $appended

Returns

static

detachEvent()

detachEvent(string  $event, callable  $handler) : static

Parameters

string $event
callable $handler

Returns

static

peekEvent()

peekEvent(string  $group, callable  $handler) : static

Parameters

string $group
callable $handler

Returns

static

fireEvent()

fireEvent(string  $event, mixed  $data = array(), mixed  $source = null) : void

Fires an event in the events manager causing that the active listeners will be notified about it

Parameters

string $event
mixed $data
mixed $source

on()

on(string  $event, callable  $handler) : static

Parameters

string $event
callable $handler

Returns

static

off()

off(string  $event = null, callable  $handler = null) : static

Parameters

string $event
callable $handler

Returns

static

emit()

emit(string  $event, array  $data = array()) : void

Parameters

string $event
array $data

__debugInfo()

__debugInfo() : array

Returns

array

dump()

dump() : array

Returns

array

toArray()

toArray() : array

Returns

array

jsonSerialize()

jsonSerialize() 

__construct()

__construct(string  $uri) 

Parameters

string $uri

__destruct()

__destruct() 

__clone()

__clone() 

getPrefix()

getPrefix() : string

Returns

string

execute()

execute(string  $type, string  $sql, array  $bind = array()) : integer

Parameters

string $type
string $sql
array $bind

Throws

\ManaPHP\Data\Db\Exception

Returns

integer

executeInsert()

executeInsert(string  $sql, array  $bind = array()) : integer

Parameters

string $sql
array $bind

Returns

integer

executeUpdate()

executeUpdate(string  $sql, array  $bind = array()) : integer

Parameters

string $sql
array $bind

Returns

integer

executeDelete()

executeDelete(string  $sql, array  $bind = array()) : integer

Parameters

string $sql
array $bind

Returns

integer

affectedRows()

affectedRows() : integer

Returns the number of affected rows by the last INSERT/UPDATE/DELETE reported by the database system

Returns

integer

fetchOne()

fetchOne(string  $sql, array  $bind = array(), integer  $mode = \PDO::FETCH_ASSOC, boolean  $useMaster = false) : array|false

Returns the first row in a SQL query result

Parameters

string $sql
array $bind
integer $mode
boolean $useMaster

Returns

array|false

fetchAll()

fetchAll(string  $sql, array  $bind = array(), integer  $mode = \PDO::FETCH_ASSOC, boolean  $useMaster = false) : array

Dumps the complete result of a query into an array

Parameters

string $sql
array $bind
integer $mode
boolean $useMaster

Returns

array

insert()

insert(string  $table, array  $record, boolean  $fetchInsertId = false) : integer|string|null

Parameters

string $table
array $record
boolean $fetchInsertId

Returns

integer|string|null

insertBySql()

insertBySql(string  $table, string  $sql, array  $bind = array()) : integer

Parameters

string $table
string $sql
array $bind

Returns

integer

update()

update(string  $table, array  $fieldValues, string|array  $conditions, array  $bind = array()) : integer

Updates data on a table using custom SQL syntax

Parameters

string $table
array $fieldValues
string|array $conditions
array $bind

Throws

\ManaPHP\Data\Db\Exception

Returns

integer

updateBySql()

updateBySql(string  $table, string  $sql, array  $bind = array()) : integer

Updates data on a table using custom SQL syntax

Parameters

string $table
string $sql
array $bind

Returns

integer

upsert()

upsert(string  $table, array  $insertFieldValues, array  $updateFieldValues = array(), string  $primaryKey = null) : integer

Updates data on a table using custom SQL syntax

Parameters

string $table
array $insertFieldValues
array $updateFieldValues
string $primaryKey

Returns

integer

delete()

delete(string  $table, string|array  $conditions, array  $bind = array()) : integer

Deletes data from a table using custom SQL syntax

Parameters

string $table
string|array $conditions
array $bind

Throws

\ManaPHP\Data\Db\Exception

Returns

integer

deleteBySql()

deleteBySql(string  $table, string  $sql, array  $bind = array()) : integer

Deletes data from a table using custom SQL syntax

Parameters

string $table
string $sql
array $bind

Returns

integer

getSQL()

getSQL() : string

Active SQL statement in the object

Returns

string

getEmulatedSQL()

getEmulatedSQL(integer  $preservedStrLength = -1) : string

Active SQL statement in the object with replace the bind with value

Parameters

integer $preservedStrLength

Returns

string

getBind()

getBind() : array

Active SQL statement in the object

Returns

array

begin()

begin() : void

Starts a transaction in the connection

Throws

\ManaPHP\Data\Db\Exception

isUnderTransaction()

isUnderTransaction() : boolean

Checks whether the connection is under a transaction

Returns

boolean

rollback()

rollback() : void

Rollbacks the active transaction in the connection

Throws

\ManaPHP\Data\Db\Exception

commit()

commit() : void

Commits the active transaction in the connection

Throws

\ManaPHP\Data\Db\Exception

getLastSql()

getLastSql() : string

Returns

string

getTables()

getTables(string  $schema = null) : array

Parameters

string $schema

Throws

\ManaPHP\Data\Db\Exception

Returns

array

buildSql()

buildSql(array  $params) : string

Parameters

array $params

Returns

string

getMetadata()

getMetadata(string  $table) : array

Parameters

string $table

Throws

\ManaPHP\Data\Db\Exception

Returns

array

close()

close() 

query()

query(string  $table = null, string  $alias = null) : \ManaPHP\Data\Db\Query

Parameters

string $table
string $alias

Returns

\ManaPHP\Data\Db\Query

_createContext()

_createContext() : object

Returns

object

_completeTable()

_completeTable(string  $table) : string

Parameters

string $table

Returns

string

_quote()

_quote(string  $value) : string

Parameters

string $value

Returns

string

_parseBindValue()

_parseBindValue(mixed  $value, integer  $preservedStrLength) : integer|string

Parameters

mixed $value
integer $preservedStrLength

Returns

integer|string