PHP 클래스 Prado\Data\DataGateway\TDataGatewayCommand

TDataGatewayCommand builds the TDbCommand for TTableGateway and TActiveRecordGateway commands such as find(), update(), insert(), etc, using the TDbCommandBuilder classes (database specific TDbCommandBuilder classes are used). Once the command is built and the query parameters are binded, the {@link OnCreateCommand} event is raised. Event handlers for the OnCreateCommand event should not alter the Command property nor the Criteria property of the TDataGatewayEventParameter. TDataGatewayCommand excutes the TDbCommands and returns the result obtained from the database (returned value depends on the method executed). The {@link OnExecuteCommand} event is raised after the command is executed and resulting data is set in the TDataGatewayResultEventParameter object's Result property.
부터: 3.1
상속: extends Prado\TComponent
파일 보기 프로젝트 열기: pradosoft/prado

공개 메소드들

메소드 설명
__construct ( $builder )
count ( TSqlCriteria $criteria ) : integer
createCriteriaFromString ( $method, $condition, $args ) : TActiveRecordCriteria
delete ( $criteria ) : integer Executes a delete command.
deleteByPk ( $keys ) : integer
find ( $criteria ) : array Find one record matching the critera.
findAll ( TSqlCriteria $criteria ) : TDbDataReader Find one or more matching records.
findAllByIndex ( $criteria, $fields, $values )
findAllByPk ( $keys ) : TDbDataReader
findAllBySql ( TSqlCriteria $criteria ) : TDbDataReader Find zero or more matching records for arbituary SQL.
findByPk ( $keys ) : array
findBySql ( TSqlCriteria $criteria ) : TDbDataReader Find one matching records for arbituary SQL.
getBuilder ( ) : TDbCommandBuilder
getDbConnection ( ) : TDbConnection
getIndexKeyCondition ( $table, $fields, $values )
getLastInsertID ( ) : mixed Iterate through all the columns and returns the last insert id of the first column that has a sequence or serial.
getTableInfo ( ) : TDbTableInfo
insert ( $data ) : mixed Inserts a new record into the table. Each array key must correspond to a column name in the table unless a null value is permitted.
onCreateCommand ( $command, $criteria ) Raised when a command is prepared and parameter binding is completed.
onExecuteCommand ( $command, $result ) Raised when a command is executed and the result from the database was returned.
update ( $data, $criteria ) : integer Updates the table with new data.
updateByPk ( $data, $keys ) : integer

보호된 메소드들

메소드 설명
extractMatchingConditions ( $method, $condition ) : array Calculates the AND/OR condition from dynamic method substrings using table meta data, allows for any AND-OR combinations.
getCompositeKeyCondition ( $values ) Construct a "pk IN ('key1', 'key2', .
getFindCommand ( TSqlCriteria $criteria ) : TDbCommand. Build the find command from the criteria. Limit, Offset and Ordering are applied if applicable.
getPrimaryKeyCondition ( $values ) : array Create the condition and parameters for find by primary.
getSqlCommand ( TSqlCriteria $criteria ) : TDbCommand Build sql command from the criteria. Limit, Offset and Ordering are applied if applicable.
quoteTuple ( $array ) : string

메소드 상세

__construct() 공개 메소드

public __construct ( $builder )

count() 공개 메소드

public count ( TSqlCriteria $criteria ) : integer
$criteria TSqlCriteria
리턴 integer number of records.

createCriteriaFromString() 공개 메소드

public createCriteriaFromString ( $method, $condition, $args ) : TActiveRecordCriteria
리턴 TActiveRecordCriteria criteria created from the method name and its arguments.

delete() 공개 메소드

Executes a delete command.
public delete ( $criteria ) : integer
리턴 integer number of records affected.

deleteByPk() 공개 메소드

public deleteByPk ( $keys ) : integer
리턴 integer number of rows affected.

extractMatchingConditions() 보호된 메소드

Calculates the AND/OR condition from dynamic method substrings using table meta data, allows for any AND-OR combinations.
protected extractMatchingConditions ( $method, $condition ) : array
리턴 array search condition substrings

find() 공개 메소드

Find one record matching the critera.
public find ( $criteria ) : array
리턴 array matching record.

findAll() 공개 메소드

Find one or more matching records.
public findAll ( TSqlCriteria $criteria ) : TDbDataReader
$criteria TSqlCriteria
리턴 TDbDataReader record reader.

findAllByIndex() 공개 메소드

public findAllByIndex ( $criteria, $fields, $values )

findAllByPk() 공개 메소드

public findAllByPk ( $keys ) : TDbDataReader
리턴 TDbDataReader record reader.

findAllBySql() 공개 메소드

Find zero or more matching records for arbituary SQL.
public findAllBySql ( TSqlCriteria $criteria ) : TDbDataReader
$criteria TSqlCriteria
리턴 TDbDataReader record reader.

findByPk() 공개 메소드

public findByPk ( $keys ) : array
리턴 array matching record.

findBySql() 공개 메소드

Find one matching records for arbituary SQL.
public findBySql ( TSqlCriteria $criteria ) : TDbDataReader
$criteria TSqlCriteria
리턴 TDbDataReader record reader.

getBuilder() 공개 메소드

public getBuilder ( ) : TDbCommandBuilder
리턴 TDbCommandBuilder

getCompositeKeyCondition() 보호된 메소드

..)" criteria.
protected getCompositeKeyCondition ( $values )

getDbConnection() 공개 메소드

public getDbConnection ( ) : TDbConnection
리턴 TDbConnection

getFindCommand() 보호된 메소드

Build the find command from the criteria. Limit, Offset and Ordering are applied if applicable.
protected getFindCommand ( TSqlCriteria $criteria ) : TDbCommand.
$criteria TSqlCriteria
리턴 TDbCommand.

getIndexKeyCondition() 공개 메소드

public getIndexKeyCondition ( $table, $fields, $values )

getLastInsertID() 공개 메소드

Iterate through all the columns and returns the last insert id of the first column that has a sequence or serial.
public getLastInsertID ( ) : mixed
리턴 mixed last insert id, null if none is found.

getPrimaryKeyCondition() 보호된 메소드

Create the condition and parameters for find by primary.
protected getPrimaryKeyCondition ( $values ) : array
리턴 array tuple($where, $parameters)

getSqlCommand() 보호된 메소드

Build sql command from the criteria. Limit, Offset and Ordering are applied if applicable.
protected getSqlCommand ( TSqlCriteria $criteria ) : TDbCommand
$criteria TSqlCriteria
리턴 TDbCommand command corresponding to the criteria.

getTableInfo() 공개 메소드

public getTableInfo ( ) : TDbTableInfo
리턴 TDbTableInfo

insert() 공개 메소드

Inserts a new record into the table. Each array key must correspond to a column name in the table unless a null value is permitted.
public insert ( $data ) : mixed
리턴 mixed last insert id if one column contains a serial or sequence, otherwise true if command executes successfully and affected 1 or more rows.

onCreateCommand() 공개 메소드

The parameter object is TDataGatewayEventParameter of which the {@link TDataGatewayEventParameter::getCommand Command} property can be inspected to obtain the sql query to be executed.
public onCreateCommand ( $command, $criteria )

onExecuteCommand() 공개 메소드

The parameter object is TDataGatewayResultEventParameter of which the {@link TDataGatewayEventParameter::getResult Result} property contains the data return from the database. The data returned can be changed by setting the {@link TDataGatewayEventParameter::setResult Result} property.
public onExecuteCommand ( $command, $result )

quoteTuple() 보호된 메소드

protected quoteTuple ( $array ) : string
리턴 string quoted recursive tuple values, e.g. "('val1', 'val2')".

update() 공개 메소드

Updates the table with new data.
public update ( $data, $criteria ) : integer
리턴 integer number of records affected.

updateByPk() 공개 메소드

public updateByPk ( $data, $keys ) : integer
리턴 integer number of records affected.