Class \Prado\Data\ActiveRecord\TActiveRecordGateway
TActiveRecordGateway excutes the SQL command queries and returns the data
record as arrays (for most finder methods).
Class hierarchy
Author: Wei Zhuo <weizho[at]gmail[dot]com>Since: 3.1
public
|
|
public
|
countRecords(TActiveRecord $record, TActiveRecordCriteria $criteria) : int
Returns the number of records that match the given criteria.
|
public
|
|
public
|
deleteRecordsByCriteria(TActiveRecord $record, TActiveRecordCriteria $criteria) : int
Delete multiple records by criteria.
|
public
|
deleteRecordsByPk(TActiveRecord $record, mixed $keys) : int
Delete multiple records using primary keys.
|
public
|
findRecordByPK(TActiveRecord $record, array<string|int, mixed> $keys) : array<string|int, mixed>
Returns record data matching the given primary key(s). If the table uses
composite key, specify the name value pairs as an array.
|
public
|
findRecordBySql(TActiveRecord $record, TActiveRecordCriteria $criteria) : array<string|int, mixed>
Return record data from sql query.
|
public
|
findRecordsByCriteria(TActiveRecord $record, TActiveRecordCriteria $criteria[, bool $iterator = false ]) : mixed
Returns record data matching the given critera. If $iterator is true, it will
return multiple rows as TDbDataReader otherwise it returns the <b>first</b> row data.
|
public
|
|
public
|
findRecordsByPks(TActiveRecord $record, array<string|int, mixed> $keys) : array<string|int, mixed>
Returns records matching the list of given primary keys.
|
public
|
findRecordsBySql(TActiveRecord $record, TActiveRecordCriteria $criteria) : TDbDataReader
Return record data from sql query.
|
public
|
|
public
|
|
public
|
getRecordTableInfo(TActiveRecord $record) : TDbTableInfo
Returns table information, trys the application cache first.
|
public
|
getTableInfo(TDbConnection $connection, string $tableName) : TDbTableInfo
Returns table information for table in the database connection.
|
public
|
|
public
|
onCreateCommand(TDataGatewayCommand $sender, TDataGatewayEventParameter $param) : mixed
Raised when a command is prepared and parameter binding is completed.
The parameter object is TDataGatewayEventParameter of which the \Prado\Data\DataGateway\TDataGatewayEventParameter::getCommand property can be inspected to obtain the sql query to be executed. This method also raises the OnCreateCommand event on the ActiveRecord object calling this gateway. |
public
|
onExecuteCommand(TDataGatewayCommand $sender, TDataGatewayResultEventParameter $param) : mixed
Raised when a command is executed and the result from the database was returned.
The parameter object is TDataGatewayResultEventParameter of which the \Prado\Data\DataGateway\TDataGatewayEventParameter::getResult property contains the data return from the database. The data returned can be changed by setting the \Prado\Data\DataGateway\TDataGatewayEventParameter::setResult property. This method also raises the OnCreateCommand event on the ActiveRecord object calling this gateway. |
public
|
|
public
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
getRecordTableName(TActiveRecord $record) : string
Gets the table name from the 'TABLE' constant of the active record
class if defined, otherwise use the class name as table name.
|
protected
|
|
protected
|
|
protected
|
updatePostInsert(TActiveRecord $record) : mixed
Sets the last insert ID to the corresponding property of the record if available.
|
public
mixed
|
DEFAULT_DATA_GATEWAY_CLASS
|
\Prado\Data\DataGateway\TDataGatewayCommand::class
|
public
mixed
|
TABLE_CONST
Constant name for specifying optional table name in TActiveRecord.
|
'TABLE'
|
public
mixed
|
TABLE_METHOD
Method name for returning optional table name in in TActiveRecord
|
'table'
|
\Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER |