PHP 클래스 Prado\Data\ActiveRecord\TActiveRecordGateway

부터: 3.1
상속: extends Prado\TComponent
파일 보기 프로젝트 열기: pradosoft/prado

공개 메소드들

메소드 설명
__construct ( TActiveRecordManager $manager ) Record gateway constructor.
countRecords ( TActiveRecord $record, $criteria ) : integer Returns the number of records that match the given criteria.
delete ( TActiveRecord $record ) : integer Delete the record.
deleteRecordsByCriteria ( TActiveRecord $record, $criteria ) : integer Delete multiple records by criteria.
deleteRecordsByPk ( TActiveRecord $record, $keys ) : integer Delete multiple records using primary keys.
findRecordByPK ( TActiveRecord $record, $keys ) : array Returns record data matching the given primary key(s). If the table uses composite key, specify the name value pairs as an array.
findRecordBySql ( TActiveRecord $record, $criteria ) : array Return record data from sql query.
findRecordsByCriteria ( TActiveRecord $record, $criteria, $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 first row data.
findRecordsByIndex ( TActiveRecord $record, $criteria, $fields, $values )
findRecordsByPks ( TActiveRecord $record, $keys ) : array Returns records matching the list of given primary keys.
findRecordsBySql ( TActiveRecord $record, $criteria ) : TDbDataReader Return record data from sql query.
getCommand ( TActiveRecord $record ) : TDataGatewayCommand
getRecordTableInfo ( TActiveRecord $record ) : TDbTableInfo Returns table information, trys the application cache first.
getTableInfo ( TDbConnection $connection, $tableName ) : TDbTableInfo Returns table information for table in the database connection.
insert ( TActiveRecord $record ) : integer Insert a new record.
onCreateCommand ( $sender, $param ) Raised when a command is prepared and parameter binding is completed.
onExecuteCommand ( $sender, $param ) Raised when a command is executed and the result from the database was returned.
update ( TActiveRecord $record ) : integer Update the record.

보호된 메소드들

메소드 설명
getInsertValues ( TActiveRecord $record ) : array
getManager ( ) : TActiveRecordManager
getPrimaryKeyValues ( TActiveRecord $record )
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.
getUpdateValues ( TActiveRecord $record )
raiseCommandEvent ( $event, $command, $record, $criteria ) Raise the corresponding command event, insert, update, delete or select.
updateAssociatedRecords ( TActiveRecord $record, $updateBelongsTo = false )
updatePostInsert ( $record ) Sets the last insert ID to the corresponding property of the record if available.

메소드 상세

__construct() 공개 메소드

Record gateway constructor.
public __construct ( TActiveRecordManager $manager )
$manager TActiveRecordManager

countRecords() 공개 메소드

Returns the number of records that match the given criteria.
public countRecords ( TActiveRecord $record, $criteria ) : integer
$record TActiveRecord
리턴 integer number of records.

delete() 공개 메소드

Delete the record.
public delete ( TActiveRecord $record ) : integer
$record TActiveRecord
리턴 integer number of rows affected.

deleteRecordsByCriteria() 공개 메소드

Delete multiple records by criteria.
public deleteRecordsByCriteria ( TActiveRecord $record, $criteria ) : integer
$record TActiveRecord
리턴 integer number of records.

deleteRecordsByPk() 공개 메소드

Delete multiple records using primary keys.
public deleteRecordsByPk ( TActiveRecord $record, $keys ) : integer
$record TActiveRecord
리턴 integer number of rows deleted.

findRecordByPK() 공개 메소드

Returns record data matching the given primary key(s). If the table uses composite key, specify the name value pairs as an array.
public findRecordByPK ( TActiveRecord $record, $keys ) : array
$record TActiveRecord
리턴 array record data

findRecordBySql() 공개 메소드

Return record data from sql query.
public findRecordBySql ( TActiveRecord $record, $criteria ) : array
$record TActiveRecord
리턴 array result.

findRecordsByCriteria() 공개 메소드

Returns record data matching the given critera. If $iterator is true, it will return multiple rows as TDbDataReader otherwise it returns the first row data.
public findRecordsByCriteria ( TActiveRecord $record, $criteria, $iterator = false ) : mixed
$record TActiveRecord
리턴 mixed matching data.

findRecordsByIndex() 공개 메소드

public findRecordsByIndex ( TActiveRecord $record, $criteria, $fields, $values )
$record TActiveRecord

findRecordsByPks() 공개 메소드

Returns records matching the list of given primary keys.
public findRecordsByPks ( TActiveRecord $record, $keys ) : array
$record TActiveRecord
리턴 array matching data.

findRecordsBySql() 공개 메소드

Return record data from sql query.
public findRecordsBySql ( TActiveRecord $record, $criteria ) : TDbDataReader
$record TActiveRecord
리턴 TDbDataReader result iterator.

getCommand() 공개 메소드

public getCommand ( TActiveRecord $record ) : TDataGatewayCommand
$record TActiveRecord
리턴 Prado\Data\DataGateway\TDataGatewayCommand

getInsertValues() 보호된 메소드

protected getInsertValues ( TActiveRecord $record ) : array
$record TActiveRecord
리턴 array insert values.

getManager() 보호된 메소드

protected getManager ( ) : TActiveRecordManager
리턴 TActiveRecordManager record manager.

getPrimaryKeyValues() 보호된 메소드

protected getPrimaryKeyValues ( TActiveRecord $record )
$record TActiveRecord

getRecordTableInfo() 공개 메소드

Returns table information, trys the application cache first.
public getRecordTableInfo ( TActiveRecord $record ) : TDbTableInfo
$record TActiveRecord
리턴 TDbTableInfo table information.

getRecordTableName() 보호된 메소드

Gets the table name from the 'TABLE' constant of the active record class if defined, otherwise use the class name as table name.
protected getRecordTableName ( TActiveRecord $record ) : string
$record TActiveRecord
리턴 string table name for the given record class.

getTableInfo() 공개 메소드

Returns table information for table in the database connection.
public getTableInfo ( TDbConnection $connection, $tableName ) : TDbTableInfo
$connection Prado\Data\TDbConnection
리턴 TDbTableInfo table details.

getUpdateValues() 보호된 메소드

protected getUpdateValues ( TActiveRecord $record )
$record TActiveRecord

insert() 공개 메소드

Insert a new record.
public insert ( TActiveRecord $record ) : integer
$record TActiveRecord
리턴 integer number of rows affected.

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. This method also raises the OnCreateCommand event on the ActiveRecord object calling this gateway.
public onCreateCommand ( $sender, $param )

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. This method also raises the OnCreateCommand event on the ActiveRecord object calling this gateway.
public onExecuteCommand ( $sender, $param )

raiseCommandEvent() 보호된 메소드

Raise the corresponding command event, insert, update, delete or select.
protected raiseCommandEvent ( $event, $command, $record, $criteria )

update() 공개 메소드

Update the record.
public update ( TActiveRecord $record ) : integer
$record TActiveRecord
리턴 integer number of rows affected.

updateAssociatedRecords() 보호된 메소드

protected updateAssociatedRecords ( TActiveRecord $record, $updateBelongsTo = false )
$record TActiveRecord

updatePostInsert() 보호된 메소드

Sets the last insert ID to the corresponding property of the record if available.
protected updatePostInsert ( $record )