Phalcon datamapper
NOTE
All classes are prefixed with Phalcon
DataMapper\Pdo\Connection¶
Class Source on GitHub
Provides array quoting, profiling, a new perform() method, new fetch*() methods
Phalcon\DataMapper\Pdo\Connection\AbstractConnectionPhalcon\DataMapper\Pdo\Connection
Uses Phalcon\DataMapper\Pdo\Connection\AbstractConnection · Phalcon\DataMapper\Pdo\Exception\DriverNotSupported · Phalcon\DataMapper\Pdo\Profiler\Profiler · Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface
Method Summary¶
public __construct(string $dsn,string $username = null,string $password = null,array $options = [],array $queries = [],ProfilerInterface $profiler = null) Constructor. public array __debugInfo() The purpose of this method is to hide sensitive data from stack traces. public void connect() Connects to the database. public void disconnect() Disconnects from the database. Properties¶
protected array $arguments = [] Methods¶
__construct()¶
public function __construct(
string $dsn,
string $username = null,
string $password = null,
array $options = [],
array $queries = [],
ProfilerInterface $profiler = null
);
Constructor.
This overrides the parent so that it can take connection attributes as a constructor parameter, and set them after connection.
__debugInfo()¶
The purpose of this method is to hide sensitive data from stack traces.
connect()¶
Connects to the database.
disconnect()¶
Disconnects from the database.
DataMapper\Pdo\ConnectionLocator¶
Class Source on GitHub
Manages Connection instances for default, read, and write connections.
Phalcon\DataMapper\Pdo\ConnectionLocator— implementsPhalcon\DataMapper\Pdo\ConnectionLocatorInterface
Uses Phalcon\DataMapper\Pdo\Connection\ConnectionInterface · Phalcon\DataMapper\Pdo\Exception\ConnectionNotFound
Method Summary¶
public __construct(ConnectionInterface $master,array $read = [],array $write = []) Constructor. public ConnectionInterface getMaster() Returns the default connection object. public ConnectionInterface getRead( string $name = "" ) Returns a read connection by name; if no name is given, picks a public ConnectionInterface getWrite( string $name = "" ) Returns a write connection by name; if no name is given, picks a public static setMaster( ConnectionInterface $callableObject ) Sets the default connection factory. public static setRead(string $name,callable $callableObject) Sets a read connection factory by name. public static setWrite(string $name,callable $callableObject) Sets a write connection factory by name. protected ConnectionInterface getConnection(string $type,string $name = "") Returns a connection by name. Properties¶
protected ConnectionInterface $master A default Connection connection factory/instance. protected array $read = [] A registry of Connection "read" factories/instances. protected array $write = [] A registry of Connection "write" factories/instances. Methods¶
__construct()¶
Constructor.
getMaster()¶
Returns the default connection object.
getRead()¶
Returns a read connection by name; if no name is given, picks a random connection; if no read connections are present, returns the default connection.
getWrite()¶
Returns a write connection by name; if no name is given, picks a random connection; if no write connections are present, returns the default connection.
setMaster()¶
Sets the default connection factory.
setRead()¶
Sets a read connection factory by name.
setWrite()¶
Sets a write connection factory by name.
getConnection()¶
Returns a connection by name.
DataMapper\Pdo\ConnectionLocatorInterface¶
Interface Source on GitHub
Locates PDO connections for default, read, and write databases.
Phalcon\DataMapper\Pdo\ConnectionLocatorInterface
Uses Phalcon\DataMapper\Pdo\Connection\ConnectionInterface
Method Summary¶
public ConnectionInterface getMaster() Returns the default connection object. public ConnectionInterface getRead( string $name = "" ) Returns a read connection by name; if no name is given, picks a public ConnectionInterface getWrite( string $name = "" ) Returns a write connection by name; if no name is given, picks a public ConnectionLocatorInterface setMaster( ConnectionInterface $callableObject ) Sets the default connection registry entry. public ConnectionLocatorInterface setRead(string $name,callable $callableObject) Sets a read connection registry entry by name. public ConnectionLocatorInterface setWrite(string $name,callable $callableObject) Sets a write connection registry entry by name. Methods¶
getMaster()¶
Returns the default connection object.
getRead()¶
Returns a read connection by name; if no name is given, picks a random connection; if no read connections are present, returns the default connection.
getWrite()¶
Returns a write connection by name; if no name is given, picks a random connection; if no write connections are present, returns the default connection.
setMaster()¶
Sets the default connection registry entry.
setRead()¶
Sets a read connection registry entry by name.
setWrite()¶
Sets a write connection registry entry by name.
DataMapper\Pdo\Connection\AbstractConnection¶
Abstract Source on GitHub
Provides array quoting, profiling, a new perform() method, new fetch*() methods
Phalcon\DataMapper\Pdo\Connection\AbstractConnection— implementsPhalcon\DataMapper\Pdo\Connection\ConnectionInterface
Uses BadMethodCallException · Phalcon\DataMapper\Pdo\Exception\UnknownDriverMethod · Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface
Method Summary¶
public __call(mixed $name,array $arguments) Proxies to PDO methods created for specific drivers; in particular, public bool beginTransaction() Begins a transaction. If the profiler is enabled, the operation will public bool commit() Commits the existing transaction. If the profiler is enabled, the public void connect() Connects to the database. public void disconnect() Disconnects from the database. public string|null errorCode() Gets the most recent error code. public array errorInfo() Gets the most recent error info. public int exec( string $statement ) Executes an SQL statement and returns the number of affected rows. If public int fetchAffected(string $statement,array $values = []) Performs a statement and returns the number of affected rows. public array fetchAll(string $statement,array $values = []) Fetches a sequential array of rows from the database; the rows are public array fetchAssoc(string $statement,array $values = []) Fetches an associative array of rows from the database; the rows are public array fetchColumn(string $statement,array $values = [],int $column = 0) Fetches a column of rows as a sequential array (default first one). public array fetchGroup(string $statement,array $values = [],int $flags = \PDO::FETCH_ASSOC) Fetches multiple from the database as an associative array. The first public object fetchObject(string $statement,array $values = [],string $className = "stdClass",array $arguments = []) Fetches one row from the database as an object where the column values public array fetchObjects(string $statement,array $values = [],string $className = "stdClass",array $arguments = []) Fetches a sequential array of rows from the database; the rows are public array fetchOne(string $statement,array $values = []) Fetches one row from the database as an associative array. public array fetchPairs(string $statement,array $values = []) Fetches an associative array of rows as key-value pairs (first column is public fetchValue(string $statement,array $values = []) Fetches the very first value (i.e., first column of the first row). public \PDO getAdapter() Return the inner PDO (if any) public mixed getAttribute( int $attribute ) Retrieve a database connection attribute public array getAvailableDrivers() Return an array of available PDO drivers (empty array if none available) public string getDriverName() Return the driver name public ProfilerInterface getProfiler() Returns the Profiler instance. public array getQuoteNames( string $driver = "" ) Gets the quote parameters based on the driver public bool inTransaction() Is a transaction currently active? If the profiler is enabled, the public bool isConnected() Is the PDO connection active? public string lastInsertId( string $name = null ) Returns the last inserted autoincrement sequence value. If the profiler public \PDOStatement perform(string $statement,array $values = []) Performs a query with bound values and returns the resulting public \PDOStatement|bool prepare(string $statement,array $options = []) Prepares an SQL statement for execution. public \PDOStatement|bool query( string $statement ) Queries the database and returns a PDOStatement. If the profiler is public string quote(mixed $value,int $type = \PDO::PARAM_STR) Quotes a value for use in an SQL statement. This differs from public bool rollBack() Rolls back the current transaction, and restores autocommit mode. If the public bool setAttribute(int $attribute,mixed $value) Set a database connection attribute public static setProfiler( ProfilerInterface $profiler ) Sets the Profiler instance. protected array fetchData(string $method,array $arguments,string $statement,array $values = []) Helper method to get data from PDO based on the method passed protected void performBind(\PDOStatement $statement,mixed $name,mixed $arguments) Bind a value using the proper PDO::PARAM_* type. Properties¶
protected \PDO $pdo protected ProfilerInterface $profiler Methods¶
__call()¶
Proxies to PDO methods created for specific drivers; in particular, sqlite and pgsql.
beginTransaction()¶
Begins a transaction. If the profiler is enabled, the operation will be recorded.
commit()¶
Commits the existing transaction. If the profiler is enabled, the operation will be recorded.
connect()¶
Connects to the database.
disconnect()¶
Disconnects from the database.
errorCode()¶
Gets the most recent error code.
errorInfo()¶
Gets the most recent error info.
exec()¶
Executes an SQL statement and returns the number of affected rows. If the profiler is enabled, the operation will be recorded.
fetchAffected()¶
Performs a statement and returns the number of affected rows.
fetchAll()¶
Fetches a sequential array of rows from the database; the rows are returned as associative arrays.
fetchAssoc()¶
Fetches an associative array of rows from the database; the rows are returned as associative arrays, and the array of rows is keyed on the first column of each row.
If multiple rows have the same first column value, the last row with that value will overwrite earlier rows. This method is more resource intensive and should be avoided if possible.
fetchColumn()¶
Fetches a column of rows as a sequential array (default first one).
fetchGroup()¶
public function fetchGroup(
string $statement,
array $values = [],
int $flags = \PDO::FETCH_ASSOC
): array;
Fetches multiple from the database as an associative array. The first column will be the index key. The default flags are PDO::FETCH_ASSOC | PDO::FETCH_GROUP
fetchObject()¶
public function fetchObject(
string $statement,
array $values = [],
string $className = "stdClass",
array $arguments = []
): object;
Fetches one row from the database as an object where the column values are mapped to object properties.
Since PDO injects property values before invoking the constructor, any initializations for defaults that you potentially have in your object's constructor, will override the values that have been injected by fetchObject. The default object returned is \stdClass
fetchObjects()¶
public function fetchObjects(
string $statement,
array $values = [],
string $className = "stdClass",
array $arguments = []
): array;
Fetches a sequential array of rows from the database; the rows are returned as objects where the column values are mapped to object properties.
Since PDO injects property values before invoking the constructor, any initializations for defaults that you potentially have in your object's constructor, will override the values that have been injected by fetchObject. The default object returned is \stdClass
fetchOne()¶
Fetches one row from the database as an associative array.
fetchPairs()¶
Fetches an associative array of rows as key-value pairs (first column is the key, second column is the value).
fetchValue()¶
Fetches the very first value (i.e., first column of the first row).
getAdapter()¶
Return the inner PDO (if any)
getAttribute()¶
Retrieve a database connection attribute
getAvailableDrivers()¶
Return an array of available PDO drivers (empty array if none available)
getDriverName()¶
Return the driver name
getProfiler()¶
Returns the Profiler instance.
getQuoteNames()¶
Gets the quote parameters based on the driver
inTransaction()¶
Is a transaction currently active? If the profiler is enabled, the operation will be recorded. If the profiler is enabled, the operation will be recorded.
isConnected()¶
Is the PDO connection active?
lastInsertId()¶
Returns the last inserted autoincrement sequence value. If the profiler is enabled, the operation will be recorded.
perform()¶
Performs a query with bound values and returns the resulting PDOStatement; array values will be passed through quote() and their respective placeholders will be replaced in the query string. If the profiler is enabled, the operation will be recorded.
prepare()¶
Prepares an SQL statement for execution.
query()¶
Queries the database and returns a PDOStatement. If the profiler is enabled, the operation will be recorded.
quote()¶
Quotes a value for use in an SQL statement. This differs from PDO::quote() in that it will convert an array into a string of comma-separated quoted values. The default type is PDO::PARAM_STR
rollBack()¶
Rolls back the current transaction, and restores autocommit mode. If the profiler is enabled, the operation will be recorded.
setAttribute()¶
Set a database connection attribute
setProfiler()¶
Sets the Profiler instance.
fetchData()¶
protected function fetchData(
string $method,
array $arguments,
string $statement,
array $values = []
): array;
Helper method to get data from PDO based on the method passed
performBind()¶
Bind a value using the proper PDO::PARAM_* type.
DataMapper\Pdo\Connection\ConnectionInterface¶
Interface Source on GitHub
Provides array quoting, profiling, a new perform() method, new fetch*() methods
Phalcon\DataMapper\Pdo\Connection\PdoInterfacePhalcon\DataMapper\Pdo\Connection\ConnectionInterface
Uses Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface
Method Summary¶
public void connect() Connects to the database. public void disconnect() Disconnects from the database. public int fetchAffected(string $statement,array $values = []) Performs a statement and returns the number of affected rows. public array fetchAll(string $statement,array $values = []) Fetches a sequential array of rows from the database; the rows are public array fetchAssoc(string $statement,array $values = []) Fetches an associative array of rows from the database; the rows are public array fetchColumn(string $statement,array $values = [],int $column = 0) Fetches a column of rows as a sequential array (default first one). public array fetchGroup(string $statement,array $values = [],int $flags = \PDO::FETCH_ASSOC) Fetches multiple from the database as an associative array. The first public object fetchObject(string $statement,array $values = [],string $className = "stdClass",array $arguments = []) Fetches one row from the database as an object where the column values public array fetchObjects(string $statement,array $values = [],string $className = "stdClass",array $arguments = []) Fetches a sequential array of rows from the database; the rows are public array fetchOne(string $statement,array $values = []) Fetches one row from the database as an associative array. public array fetchPairs(string $statement,array $values = []) Fetches an associative array of rows as key-value pairs (first column is public mixed fetchValue(string $statement,array $values = []) Fetches the very first value (i.e., first column of the first row). public \PDO getAdapter() Return the inner PDO (if any) public ProfilerInterface getProfiler() Returns the Profiler instance. public bool isConnected() Is the PDO connection active? public \PDOStatement perform(string $statement,array $values = []) Performs a query with bound values and returns the resulting public setProfiler( ProfilerInterface $profiler ) Sets the Profiler instance. Methods¶
connect()¶
Connects to the database.
disconnect()¶
Disconnects from the database.
fetchAffected()¶
Performs a statement and returns the number of affected rows.
fetchAll()¶
Fetches a sequential array of rows from the database; the rows are returned as associative arrays.
fetchAssoc()¶
Fetches an associative array of rows from the database; the rows are returned as associative arrays, and the array of rows is keyed on the first column of each row.
If multiple rows have the same first column value, the last row with that value will overwrite earlier rows. This method is more resource intensive and should be avoided if possible.
fetchColumn()¶
Fetches a column of rows as a sequential array (default first one).
fetchGroup()¶
public function fetchGroup(
string $statement,
array $values = [],
int $flags = \PDO::FETCH_ASSOC
): array;
Fetches multiple from the database as an associative array. The first column will be the index key. The default flags are PDO::FETCH_ASSOC | PDO::FETCH_GROUP
fetchObject()¶
public function fetchObject(
string $statement,
array $values = [],
string $className = "stdClass",
array $arguments = []
): object;
Fetches one row from the database as an object where the column values are mapped to object properties.
Since PDO injects property values before invoking the constructor, any initializations for defaults that you potentially have in your object's constructor, will override the values that have been injected by fetchObject. The default object returned is \stdClass
fetchObjects()¶
public function fetchObjects(
string $statement,
array $values = [],
string $className = "stdClass",
array $arguments = []
): array;
Fetches a sequential array of rows from the database; the rows are returned as objects where the column values are mapped to object properties.
Since PDO injects property values before invoking the constructor, any initializations for defaults that you potentially have in your object's constructor, will override the values that have been injected by fetchObject. The default object returned is \stdClass
fetchOne()¶
Fetches one row from the database as an associative array.
fetchPairs()¶
Fetches an associative array of rows as key-value pairs (first column is the key, second column is the value).
fetchValue()¶
Fetches the very first value (i.e., first column of the first row).
getAdapter()¶
Return the inner PDO (if any)
getProfiler()¶
Returns the Profiler instance.
isConnected()¶
Is the PDO connection active?
perform()¶
Performs a query with bound values and returns the resulting PDOStatement; array values will be passed through quote() and their respective placeholders will be replaced in the query string. If the profiler is enabled, the operation will be recorded.
setProfiler()¶
Sets the Profiler instance.
DataMapper\Pdo\Connection\Decorated¶
Class Source on GitHub
Decorates an existing PDO instance with the extended methods.
Phalcon\DataMapper\Pdo\Connection\AbstractConnectionPhalcon\DataMapper\Pdo\Connection\Decorated
Uses Phalcon\DataMapper\Pdo\Exception\CannotDisconnect · Phalcon\DataMapper\Pdo\Profiler\Profiler · Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface
Method Summary¶
public __construct(\PDO $pdo,ProfilerInterface $profiler = null) Constructor. public void connect() Connects to the database. public void disconnect() Disconnects from the database; disallowed with decorated PDO connections. Methods¶
__construct()¶
Constructor.
This overrides the parent so that it can take an existing PDO instance and decorate it with the extended methods.
connect()¶
Connects to the database.
disconnect()¶
Disconnects from the database; disallowed with decorated PDO connections.
DataMapper\Pdo\Connection\PdoInterface¶
Interface Source on GitHub
An interface to the native PDO object.
Phalcon\DataMapper\Pdo\Connection\PdoInterface
Method Summary¶
public bool beginTransaction() Begins a transaction. If the profiler is enabled, the operation will public bool commit() Commits the existing transaction. If the profiler is enabled, the public null|string errorCode() Gets the most recent error code. public array errorInfo() Gets the most recent error info. public int exec( string $statement ) Executes an SQL statement and returns the number of affected rows. If public mixed getAttribute( int $attribute ) Retrieve a database connection attribute public array getAvailableDrivers() Return an array of available PDO drivers (empty array if none available) public bool inTransaction() Is a transaction currently active? If the profiler is enabled, the public string lastInsertId( string $name = null ) Returns the last inserted autoincrement sequence value. If the profiler public \PDOStatement|bool prepare(string $statement,array $options = []) Prepares an SQL statement for execution. public \PDOStatement|bool query( string $statement ) Queries the database and returns a PDOStatement. If the profiler is public string quote(mixed $value,int $type = \PDO::PARAM_STR) Quotes a value for use in an SQL statement. This differs from public bool rollBack() Rolls back the current transaction, and restores autocommit mode. If the public bool setAttribute(int $attribute,mixed $value) Set a database connection attribute Methods¶
beginTransaction()¶
Begins a transaction. If the profiler is enabled, the operation will be recorded.
commit()¶
Commits the existing transaction. If the profiler is enabled, the operation will be recorded.
errorCode()¶
Gets the most recent error code.
errorInfo()¶
Gets the most recent error info.
exec()¶
Executes an SQL statement and returns the number of affected rows. If the profiler is enabled, the operation will be recorded.
getAttribute()¶
Retrieve a database connection attribute
getAvailableDrivers()¶
Return an array of available PDO drivers (empty array if none available)
inTransaction()¶
Is a transaction currently active? If the profiler is enabled, the operation will be recorded. If the profiler is enabled, the operation will be recorded.
lastInsertId()¶
Returns the last inserted autoincrement sequence value. If the profiler is enabled, the operation will be recorded.
prepare()¶
Prepares an SQL statement for execution.
query()¶
Queries the database and returns a PDOStatement. If the profiler is enabled, the operation will be recorded.
quote()¶
Quotes a value for use in an SQL statement. This differs from PDO::quote() in that it will convert an array into a string of comma-separated quoted values. The default type is PDO::PARAM_STR
rollBack()¶
Rolls back the current transaction, and restores autocommit mode. If the profiler is enabled, the operation will be recorded.
setAttribute()¶
Set a database connection attribute
DataMapper\Pdo\Exception\CannotDisconnect¶
Class Source on GitHub
ExtendedPdo could not disconnect; e.g., because its PDO connection was created externally and then injected.
\ExceptionPhalcon\DataMapper\Pdo\Exception\ExceptionPhalcon\DataMapper\Pdo\Exception\CannotDisconnect
DataMapper\Pdo\Exception\ConnectionNotFound¶
Class Source on GitHub
Locator could not find a named connection.
\ExceptionPhalcon\DataMapper\Pdo\Exception\ExceptionPhalcon\DataMapper\Pdo\Exception\ConnectionNotFound
DataMapper\Pdo\Exception\DriverNotSupported¶
Class Source on GitHub
InvalidArgumentExceptionPhalcon\DataMapper\Pdo\Exception\DriverNotSupported
Uses InvalidArgumentException
Method Summary¶
Methods¶
__construct()¶
DataMapper\Pdo\Exception\Exception¶
Class Source on GitHub
Base Exception class
\ExceptionPhalcon\DataMapper\Pdo\Exception\Exception
DataMapper\Pdo\Exception\UnknownDriverMethod¶
Class Source on GitHub
BadMethodCallExceptionPhalcon\DataMapper\Pdo\Exception\UnknownDriverMethod
Uses BadMethodCallException
Method Summary¶
Methods¶
__construct()¶
DataMapper\Pdo\Exception\UnknownQueryMethod¶
Class Source on GitHub
BadMethodCallExceptionPhalcon\DataMapper\Pdo\Exception\UnknownQueryMethod
Uses BadMethodCallException
Method Summary¶
Methods¶
__construct()¶
DataMapper\Pdo\Profiler\MemoryLogger¶
Class Source on GitHub
A memory-based logger.
Phalcon\DataMapper\Pdo\Profiler\MemoryLogger— implementsPhalcon\Logger\LoggerInterface
Uses Phalcon\Logger\Adapter\AdapterInterface · Phalcon\Logger\Adapter\Noop · Phalcon\Logger\Enum · Phalcon\Logger\LoggerInterface
Method Summary¶
public void alert(string $message,array $context = []) public void critical(string $message,array $context = []) public void debug(string $message,array $context = []) public void emergency(string $message,array $context = []) public void error(string $message,array $context = []) public AdapterInterface getAdapter( string $name ) Returns an adapter from the stack public array getAdapters() Returns the adapter stack array public int getLogLevel() Returns the log level public array getMessages() Returns the logged messages. public string getName() Returns the name of the logger public void info(string $message,array $context = []) public void log(mixed $level,string $message,array $context = []) Logs a message. public void notice(string $message,array $context = []) public void trace(string $message,array $context = []) public void warning(string $message,array $context = []) Properties¶
protected array $messages = [] Methods¶
alert()¶
critical()¶
debug()¶
emergency()¶
error()¶
getAdapter()¶
Returns an adapter from the stack
getAdapters()¶
Returns the adapter stack array
getLogLevel()¶
Returns the log level
getMessages()¶
Returns the logged messages.
getName()¶
Returns the name of the logger
info()¶
log()¶
Logs a message.
notice()¶
trace()¶
warning()¶
DataMapper\Pdo\Profiler\Profiler¶
Class Source on GitHub
Sends query profiles to a logger.
Phalcon\DataMapper\Pdo\Profiler\Profiler— implementsPhalcon\DataMapper\Pdo\Profiler\ProfilerInterface
Uses Phalcon\DataMapper\Pdo\Exception\Exception · Phalcon\Logger\Enum · Phalcon\Logger\LoggerInterface · Phalcon\Support\Helper\Json\Encode
Method Summary¶
public __construct( LoggerInterface $logger = null ) Constructor. public void finish(string $statement = null,array $values = []) Finishes and logs a profile entry. public string getLogFormat() Returns the log message format string, with placeholders. public string getLogLevel() Returns the level at which to log profile messages. public LoggerInterface getLogger() Returns the underlying logger instance. public bool isActive() Returns true if logging is active. public ProfilerInterface setActive( bool $active ) Enable or disable profiler logging. public ProfilerInterface setLogFormat( string $logFormat ) Sets the log message format string, with placeholders. public ProfilerInterface setLogLevel( string $logLevel ) Level at which to log profile messages. public void start( string $method ) Starts a profile entry. Properties¶
protected bool $active = false protected array $context = [] protected string $logFormat = "" protected int|string $logLevel = 0 protected LoggerInterface $logger Methods¶
__construct()¶
Constructor.
finish()¶
Finishes and logs a profile entry.
getLogFormat()¶
Returns the log message format string, with placeholders.
getLogLevel()¶
Returns the level at which to log profile messages.
getLogger()¶
Returns the underlying logger instance.
isActive()¶
Returns true if logging is active.
setActive()¶
Enable or disable profiler logging.
setLogFormat()¶
Sets the log message format string, with placeholders.
setLogLevel()¶
Level at which to log profile messages.
start()¶
Starts a profile entry.
DataMapper\Pdo\Profiler\ProfilerInterface¶
Interface Source on GitHub
Interface to send query profiles to a logger.
Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface
Uses Phalcon\Logger\LoggerInterface
Method Summary¶
public void finish(string $statement = null,array $values = []) Finishes and logs a profile entry. public string getLogFormat() Returns the log message format string, with placeholders. public string getLogLevel() Returns the level at which to log profile messages. public LoggerInterface getLogger() Returns the underlying logger instance. public bool isActive() Returns true if logging is active. public ProfilerInterface setActive( bool $active ) Enable or disable profiler logging. public ProfilerInterface setLogFormat( string $logFormat ) Sets the log message format string, with placeholders. public ProfilerInterface setLogLevel( string $logLevel ) Level at which to log profile messages. public void start( string $method ) Starts a profile entry. Methods¶
finish()¶
Finishes and logs a profile entry.
getLogFormat()¶
Returns the log message format string, with placeholders.
getLogLevel()¶
Returns the level at which to log profile messages.
getLogger()¶
Returns the underlying logger instance.
isActive()¶
Returns true if logging is active.
setActive()¶
Enable or disable profiler logging.
setLogFormat()¶
Sets the log message format string, with placeholders.
setLogLevel()¶
Level at which to log profile messages.
start()¶
Starts a profile entry.
DataMapper\Query\AbstractConditions¶
Abstract Source on GitHub
Class AbstractConditions
Phalcon\DataMapper\Query\AbstractQueryPhalcon\DataMapper\Query\AbstractConditions
Method Summary¶
public AbstractConditions andWhere(string $condition,mixed $value = null,int $type = -1) Sets a AND for a WHERE condition public AbstractConditions appendWhere(string $condition,mixed $value = null,int $type = -1) Concatenates to the most recent WHERE clause public AbstractConditions limit( int $limit ) Sets the LIMIT clause public AbstractConditions offset( int $offset ) Sets the OFFSET clause public AbstractConditions orWhere(string $condition,mixed $value = null,int $type = -1) Sets a OR for a WHERE condition public AbstractConditions orderBy( mixed $orderBy ) Sets the ORDER BY public AbstractConditions where(string $condition,mixed $value = null,int $type = -1) Sets a WHERE condition public AbstractConditions whereEquals( array $columnsValues ) protected void addCondition(string $store,string $andor,string $condition,mixed $value = null,int $type = -1) Appends a conditional protected void appendCondition(string $store,string $condition,mixed $value = null,int $type = -1) Concatenates a conditional protected string buildBy( string $type ) Builds a BY list protected string buildCondition( string $type ) Builds the conditional string protected string buildLimit() Builds the LIMIT clause protected string buildLimitCommon() Builds the LIMIT clause for all drivers protected string buildLimitEarly() Builds the early LIMIT clause - MS SQLServer protected string buildLimitSqlsrv() Builds the LIMIT clause for MSSQLServer protected void processValue(string $store,mixed $data) Processes a value (array or string) and merges it with the store Methods¶
andWhere()¶
public function andWhere(
string $condition,
mixed $value = null,
int $type = -1
): AbstractConditions;
Sets a AND for a WHERE condition
appendWhere()¶
public function appendWhere(
string $condition,
mixed $value = null,
int $type = -1
): AbstractConditions;
Concatenates to the most recent WHERE clause
limit()¶
Sets the LIMIT clause
offset()¶
Sets the OFFSET clause
orWhere()¶
public function orWhere(
string $condition,
mixed $value = null,
int $type = -1
): AbstractConditions;
Sets a OR for a WHERE condition
orderBy()¶
Sets the ORDER BY
where()¶
public function where(
string $condition,
mixed $value = null,
int $type = -1
): AbstractConditions;
Sets a WHERE condition
whereEquals()¶
addCondition()¶
protected function addCondition(
string $store,
string $andor,
string $condition,
mixed $value = null,
int $type = -1
): void;
Appends a conditional
appendCondition()¶
protected function appendCondition(
string $store,
string $condition,
mixed $value = null,
int $type = -1
): void;
Concatenates a conditional
buildBy()¶
Builds a BY list
buildCondition()¶
Builds the conditional string
buildLimit()¶
Builds the LIMIT clause
buildLimitCommon()¶
Builds the LIMIT clause for all drivers
buildLimitEarly()¶
Builds the early LIMIT clause - MS SQLServer
buildLimitSqlsrv()¶
Builds the LIMIT clause for MSSQLServer
processValue()¶
Processes a value (array or string) and merges it with the store
DataMapper\Query\AbstractQuery¶
Abstract Source on GitHub
Class AbstractQuery
Phalcon\DataMapper\Query\AbstractQuery
Uses Phalcon\DataMapper\Pdo\Connection
Method Summary¶
public __construct(Connection $connection,Bind $bind) AbstractQuery constructor. public string bindInline(mixed $value,int $type = -1) Binds a value inline public AbstractQuery bindValue(string $key,mixed $value,int $type = -1) Binds a value - auto-detects the type if necessary public AbstractQuery bindValues( array $values ) Binds an array of values public array getBindValues() Returns all the bound values public string getStatement() Return the generated statement public perform() Performs a statement in the connection public string quoteIdentifier(string $name,int $type = \PDO::PARAM_STR) Quotes the identifier public void reset() Resets the internal array public void resetColumns() Resets the columns public void resetFlags() Resets the flags public void resetFrom() Resets the from public void resetGroupBy() Resets the group by public void resetHaving() Resets the having public void resetLimit() Resets the limit and offset public void resetOrderBy() Resets the order by public void resetWhere() Resets the where public void setFlag(string $flag,bool $enable = true) Sets a flag for the query such as "DISTINCT" protected buildFlags() Builds the flags statement(s) protected string buildReturning() Builds the RETURNING clause protected string indent(array $collection,string $glue = "") Indents a collection Properties¶
protected Bind $bind protected Connection $connection protected array $store = [] Methods¶
__construct()¶
AbstractQuery constructor.
bindInline()¶
Binds a value inline
bindValue()¶
Binds a value - auto-detects the type if necessary
bindValues()¶
Binds an array of values
getBindValues()¶
Returns all the bound values
getStatement()¶
Return the generated statement
perform()¶
Performs a statement in the connection
quoteIdentifier()¶
Quotes the identifier
reset()¶
Resets the internal array
resetColumns()¶
Resets the columns
resetFlags()¶
Resets the flags
resetFrom()¶
Resets the from
resetGroupBy()¶
Resets the group by
resetHaving()¶
Resets the having
resetLimit()¶
Resets the limit and offset
resetOrderBy()¶
Resets the order by
resetWhere()¶
Resets the where
setFlag()¶
Sets a flag for the query such as "DISTINCT"
buildFlags()¶
Builds the flags statement(s)
buildReturning()¶
Builds the RETURNING clause
indent()¶
Indents a collection
DataMapper\Query\Bind¶
Class Source on GitHub
Class Bind
Phalcon\DataMapper\Query\Bind
Method Summary¶
public string bindInline(mixed $value,int $type = -1) public void remove( string $key ) Removes a value from the store public void setValue(string $key,mixed $value,int $type = -1) Sets a value public void setValues(array $values,int $type = -1) Sets values from an array public array toArray() Returns the internal collection protected int getType( mixed $value ) Auto detects the PDO type protected string inlineArray(array $data,int $type) Processes an array - if passed as an inline parameter Properties¶
protected int $inlineCount = 0 protected array $store = [] Methods¶
bindInline()¶
remove()¶
Removes a value from the store
setValue()¶
Sets a value
setValues()¶
Sets values from an array
toArray()¶
Returns the internal collection
getType()¶
Auto detects the PDO type
inlineArray()¶
Processes an array - if passed as an inline parameter
DataMapper\Query\Delete¶
Class Source on GitHub
Delete Query
Phalcon\DataMapper\Query\AbstractQueryPhalcon\DataMapper\Query\AbstractConditionsPhalcon\DataMapper\Query\Delete
Uses Phalcon\DataMapper\Pdo\Connection
Method Summary¶
public __construct(Connection $connection,Bind $bind) Delete constructor. public Delete from( string $table ) Adds table(s) in the query public string getStatement() public void reset() Resets the internal store public Delete returning( array $columns ) Adds the RETURNING clause Methods¶
__construct()¶
Delete constructor.
from()¶
Adds table(s) in the query
getStatement()¶
reset()¶
Resets the internal store
returning()¶
Adds the RETURNING clause
DataMapper\Query\Insert¶
Class Source on GitHub
Insert Query
Phalcon\DataMapper\Query\AbstractQueryPhalcon\DataMapper\Query\Insert
Uses Phalcon\DataMapper\Pdo\Connection
Method Summary¶
public __construct(Connection $connection,Bind $bind) Insert constructor. public Insert column(string $column,mixed $value = null,int $type = -1) Sets a column for the INSERT query public Insert columns( array $columns ) Mass sets columns and values for the INSERT public string getLastInsertId( string $name = null ) Returns the id of the last inserted record public string getStatement() public Insert into( string $table ) Adds table(s) in the query public void reset() Resets the internal store public Insert returning( array $columns ) Adds the RETURNING clause public Insert set(string $column,mixed $value = null) Sets a column = value condition Methods¶
__construct()¶
Insert constructor.
column()¶
Sets a column for the INSERT query
columns()¶
Mass sets columns and values for the INSERT
getLastInsertId()¶
Returns the id of the last inserted record
getStatement()¶
into()¶
Adds table(s) in the query
reset()¶
Resets the internal store
returning()¶
Adds the RETURNING clause
set()¶
Sets a column = value condition
DataMapper\Query\QueryFactory¶
Class Source on GitHub
QueryFactory
Phalcon\DataMapper\Query\QueryFactory
Uses Phalcon\DataMapper\Pdo\Connection
Method Summary¶
public __construct( string $selectClass = "" ) QueryFactory constructor. public Bind newBind() Create a new Bind object public Delete newDelete( Connection $connection ) Create a new Delete object public Insert newInsert( Connection $connection ) Create a new Insert object public Select newSelect( Connection $connection ) Create a new Select object public Update newUpdate( Connection $connection ) Create a new Update object Properties¶
protected string $selectClass = "" Methods¶
__construct()¶
QueryFactory constructor.
newBind()¶
Create a new Bind object
newDelete()¶
Create a new Delete object
newInsert()¶
Create a new Insert object
newSelect()¶
Create a new Select object
newUpdate()¶
Create a new Update object
DataMapper\Query\Select¶
Class Source on GitHub
Select Query
Phalcon\DataMapper\Query\AbstractQueryPhalcon\DataMapper\Query\AbstractConditionsPhalcon\DataMapper\Query\Select
Uses BadMethodCallException · Phalcon\DataMapper\Pdo\Exception\UnknownQueryMethod
Method Summary¶
public __call(string $method,array $params) Proxied methods to the connection public Select andHaving(string $condition,mixed $value = null,int $type = -1) Sets a AND for a HAVING condition public Select appendHaving(string $condition,mixed $value = null,int $type = -1) Concatenates to the most recent HAVING clause public Select appendJoin(string $condition,mixed $value = null,int $type = -1) Concatenates to the most recent JOIN clause public Select asAlias( string $asAlias ) The AS statement for the query - useful in sub-queries public Select columns( array $columns ) The columns to select from. If a key is set in the array element, the public Select distinct( bool $enable = true ) public Select forUpdate( bool $enable = true ) Enable the FOR UPDATE for the query public Select from( string $table ) Adds table(s) in the query public string getStatement() Returns the compiled SQL statement public Select groupBy( mixed $groupBy ) Sets the GROUP BY public bool hasColumns() Whether the query has columns or not public Select having(string $condition,mixed $value = null,int $type = -1) Sets a HAVING condition public Select join(string $join,string $table,string $condition,mixed $value = null,int $type = -1) Sets a 'JOIN' condition public Select orHaving(string $condition,mixed $value = null,int $type = -1) Sets a OR for a HAVING condition public void reset() Resets the internal collections public Select subSelect() Start a sub-select public Select union() Start a UNION public Select unionAll() Start a UNION ALL protected string getCurrentStatement( string $suffix = "" ) Statement builder Constants¶
string JOIN_INNER = "INNER" string JOIN_LEFT = "LEFT" string JOIN_NATURAL = "NATURAL" string JOIN_RIGHT = "RIGHT" Properties¶
protected string $asAlias = "" protected bool $forUpdate = false Methods¶
__call()¶
Proxied methods to the connection
andHaving()¶
Sets a AND for a HAVING condition
appendHaving()¶
Concatenates to the most recent HAVING clause
appendJoin()¶
Concatenates to the most recent JOIN clause
asAlias()¶
The AS statement for the query - useful in sub-queries
columns()¶
The columns to select from. If a key is set in the array element, the key will be used as the alias
distinct()¶
forUpdate()¶
Enable the FOR UPDATE for the query
from()¶
Adds table(s) in the query
getStatement()¶
Returns the compiled SQL statement
groupBy()¶
Sets the GROUP BY
hasColumns()¶
Whether the query has columns or not
having()¶
Sets a HAVING condition
join()¶
public function join(
string $join,
string $table,
string $condition,
mixed $value = null,
int $type = -1
): Select;
Sets a 'JOIN' condition
orHaving()¶
Sets a OR for a HAVING condition
reset()¶
Resets the internal collections
subSelect()¶
Start a sub-select
union()¶
Start a UNION
unionAll()¶
Start a UNION ALL
getCurrentStatement()¶
Statement builder
DataMapper\Query\Update¶
Class Source on GitHub
Update Query
Phalcon\DataMapper\Query\AbstractQueryPhalcon\DataMapper\Query\AbstractConditionsPhalcon\DataMapper\Query\Update
Uses Phalcon\DataMapper\Pdo\Connection
Method Summary¶
public __construct(Connection $connection,Bind $bind) Update constructor. public Update column(string $column,mixed $value = null,int $type = -1) Sets a column for the UPDATE query public Update columns( array $columns ) Mass sets columns and values for the UPDATE public Update from( string $table ) Adds table(s) in the query public string getStatement() public bool hasColumns() Whether the query has columns or not public void reset() Resets the internal store public Update returning( array $columns ) Adds the RETURNING clause public Update set(string $column,mixed $value = null) Sets a column = value condition Methods¶
__construct()¶
Update constructor.
column()¶
Sets a column for the UPDATE query
columns()¶
Mass sets columns and values for the UPDATE
from()¶
Adds table(s) in the query
getStatement()¶
hasColumns()¶
Whether the query has columns or not
reset()¶
Resets the internal store
returning()¶
Adds the RETURNING clause
set()¶
Sets a column = value condition