TTableGateway class provides several find methods to get data from the database and update, insert, and delete methods.
Each method maps the input parameters into a SQL call and executes the SQL against a database connection. The TTableGateway is stateless (with respect to the data and data objects), as its role is to push data back and forth.
Example usage:
All methods that may return more than one row of data will return an TDbDataReader iterator.
The OnCreateCommand event is raised when a command is prepared and parameter binding is completed. The parameter object is a TDataGatewayEventParameter of which the TDataGatewayEventParameter::getCommand property can be inspected to obtain the sql query to be executed.
The OnExecuteCommand event is raised when a command is executed and the result from the database was returned. The parameter object is a TDataGatewayResultEventParameter of which the TDataGatewayEventParameter::getResult property contains the data return from the database. The data returned can be changed by setting the TDataGatewayEventParameter::setResult property.
Located in /Data/DataGateway/TTableGateway.php (line 79)
TComponent | --TTableGateway
Creates a new generic table gateway for a given table or view name and a database connection.
Find the number of records.
Delete records from the table with condition given by $where and binding values specified by $parameter argument.
This method uses additional arguments as $parameters. E.g.
Alias for deleteByPk()
Delete records by primary key. Usage:
For composite primary keys (determined from the table definitions):
Find one single record that matches the criteria.
Usage:
Accepts same parameters as find(), but returns TDbDataReader instead.
Similar to findByPk(), but returns TDbDataReader instead.
For scalar primary keys:
For composite keys:
Execute arbituary sql command with binding parameters.
Find one record using only the primary key or composite primary keys. Usage:
Execute arbituary sql command with binding parameters.
Create a new TSqlCriteria object from a string $criteria. The $args are additional parameters and are used in place of the $parameters if $parameters is not an array and $args is an arrary.
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.
Raised when a command is prepared and parameter binding is completed.
The parameter object is TDataGatewayEventParameter of which the TDataGatewayEventParameter::getCommand property can be inspected to obtain the sql query to be executed.
Raised when a command is executed and the result from the database was returned.
The parameter object is TDataGatewayResultEventParameter of which the TDataGatewayEventParameter::getResult property contains the data return from the database. The data returned can be changed by setting the TDataGatewayEventParameter::setResult property.
Sets up the command builder for the given table.
Updates the table with new name-value pair $data. Each array key must correspond to a column name in the table. The update condition is specified by the $where argument and additional binding values can be specified using the $parameter argument.
This method uses additional arguments as $parameters. E.g.
Dynamic find method using parts of method name as search criteria.
Method name starting with "findBy" only returns 1 record. Method name starting with "findAllBy" returns 0 or more records. Method name starting with "deleteBy" deletes records by the trail criteria. The condition is taken as part of the method name after "findBy", "findAllBy" or "deleteBy".
The following are equivalent:
Inherited From TComponent
TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()
Documentation generated on Mon, 25 Jun 2012 14:39:22 +0200 by phpDocumentor 1.4.3