PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TActiveRecord

Base class for active records.

An active record creates an object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data.

Active record objects are stateful, this is main difference between the TActiveRecord implementation and the TTableGateway implementation.

The essence of an Active Record is an object model of the domain (e.g. products, items) that incorporates both behavior and data in which the classes match very closely the record structure of an underlying database. Each Active Record is responsible for saving and loading to the database and also for any domain logic that acts on the data.

The Active Record provides methods that do the following: 1. Construct an instance of the Active Record from a SQL result set row. 2. Construct a new instance for later insertion into the table. 3. Finder methods to wrap commonly used SQL queries and return Active Record objects. 4. Update the database and insert into it the data in the Active Record.

Example:

class UserRecord extends TActiveRecord
{
    const TABLE='users'; //optional table name.

    public $username; //corresponds to the fieldname in the table
    public $email;

    //returns active record finder instance
    public static function finder($className=__CLASS__)
    {
        return parent::finder($className);
    }
}

//create a connection and give it to the ActiveRecord manager.
$dsn = 'pgsql:host=localhost;dbname=test';
$conn = new TDbConnection($dsn, 'dbuser','dbpass');
TActiveRecordManager::getInstance()->setDbConnection($conn);

//load the user record with username (primary key) 'admin'.
$user = UserRecord::finder()->findByPk('admin');
$user->email = 'admin@example.org';
$user->save(); //update the 'admin' record.

Since v3.1.1, TActiveRecord starts to support column mapping. The physical column names (defined in database) can be mapped to logical column names (defined in active classes as public properties.) To use this feature, declare a static class variable COLUMN_MAPPING like the following:

class UserRecord extends TActiveRecord
{
    const TABLE='users';
    public static $COLUMN_MAPPING=array
    (
        'user_id'=>'username',
        'email_address'=>'email',
    );
    public $username;
    public $email;
}

In the above, the 'users' table consists of 'user_id' and 'email_address' columns, while the UserRecord class declares 'username' and 'email' properties. By using column mapping, we can regularize the naming convention of column names in active record.

Since v3.1.2, TActiveRecord enhanced its support to access of foreign objects. By declaring a public static variable RELATIONS like the following, one can access the corresponding foreign objects easily:

class UserRecord extends TActiveRecord
{
    const TABLE='users';
    public static $RELATIONS=array
    (
        'department'=>array(self::BELONGS_TO, 'DepartmentRecord', 'department_id'),
        'contacts'=>array(self::HAS_MANY, 'ContactRecord', 'user_id'),
    );
}

In the above, the users table is related with departments table (represented by DepartmentRecord) and contacts table (represented by ContactRecord). Now, given a UserRecord instance $user, one can access its department and contacts simply by: $user->department and $user->contacts. No explicit data fetching is needed. Internally, the foreign objects are fetched in a lazy way, which avoids unnecessary overhead if the foreign objects are not accessed at all.

Since v3.1.2, new events OnInsert, OnUpdate and OnDelete are available. The event OnInsert, OnUpdate and OnDelete methods are executed before inserting, updating, and deleting the current record, respectively. You may override these methods; a TActiveRecordChangeEventParameter parameter is passed to these methods. The property TActiveRecordChangeEventParameter::setIsValid IsValid of the parameter can be set to false to prevent the change action to be executed. This can be used, for example, to validate the record before the action is executed. For example, in the following the password property is hashed before a new record is inserted.

class UserRecord extends TActiveRecord
{
     function OnInsert($param)
     {
         //parent method should be called to raise the event
         parent::OnInsert($param);
         $this->nounce = md5(time());
         $this->password = md5($this->password.$this->nounce);
     }
}

Since v3.1.3 you can also define a method that returns the table name.

class UserRecord extends TActiveRecord
{
    public function table()
    {
         return 'users';
    }

}
TComponent
Extended by TActiveRecord
Abstract
Package: System\Data\ActiveRecord
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Wei Zhuo <weizho[at]gmail[dot]com>
Since: 3.1
Located at Data/ActiveRecord/TActiveRecord.php
Methods summary
public
# __sleep( )

Prevent __call() method creating __sleep() when serializing.

Prevent __call() method creating __sleep() when serializing.

Overrides

TComponent::__sleep()
public
# __wakeup( )

Prevent __call() method creating __wakeup() when unserializing.

Prevent __call() method creating __wakeup() when unserializing.

Overrides

TComponent::__wakeup()
public
# __construct( array $data = array(), TDbConnection $connection = null )

Create a new instance of an active record with given $data. The record can be saved to the database specified by the $connection object.

Create a new instance of an active record with given $data. The record can be saved to the database specified by the $connection object.

Parameters

$data
array
optional name value pair record data.
$connection
TDbConnection
optional database connection this object record use.

Overrides

TComponent::__construct()
public mixed
# __get( string $name )

Magic method for reading properties. This method is overriden to provide read access to the foreign objects via the key names declared in the RELATIONS array.

Magic method for reading properties. This method is overriden to provide read access to the foreign objects via the key names declared in the RELATIONS array.

Parameters

$name
string
property name

Returns

mixed
property value.

Throws

TInvalidOperationException
if the property/event is not defined.

Since

3.1.2

Overrides

TComponent::__get()
public
# __set( string $name, mixed $value )

Magic method for writing properties. This method is overriden to provide write access to the foreign objects via the key names declared in the RELATIONS array.

Magic method for writing properties. This method is overriden to provide write access to the foreign objects via the key names declared in the RELATIONS array.

Parameters

$name
string
property name
$value
mixed
property value.

Throws

TInvalidOperationException
If the property is not defined or read-only.

Since

3.1.2

Overrides

TComponent::__set()
public
# copyFrom( mixed $data )

Copies data from an array or another object.

Copies data from an array or another object.

Throws

TActiveRecordException
if data is not array or not object.
public static
# getActiveDbConnection( )
public TDbConnection
# getDbConnection( )

Gets the current Db connection, the connection object is obtained from the TActiveRecordManager if connection is currently null.

Gets the current Db connection, the connection object is obtained from the TActiveRecordManager if connection is currently null.

Returns

TDbConnection
current db connection for this object.
public
# setDbConnection( TDbConnection $connection )

Parameters

$connection
TDbConnection
db connection object for this record.
public TDbTableInfo
# getRecordTableInfo( )

Returns

TDbTableInfo
the meta information of the table associated with this AR class.
public boolean
# equals( TActiveRecord $record, boolean $strict = false )

Compare two records using their primary key values (all column values if table does not defined primary keys). The default uses simple == for comparison of their values. Set $strict=true for identity comparison (===).

Compare two records using their primary key values (all column values if table does not defined primary keys). The default uses simple == for comparison of their values. Set $strict=true for identity comparison (===).

Parameters

$record
TActiveRecord
another record to compare with.
$strict
boolean
true to perform strict identity comparison

Returns

boolean
true if $record equals, false otherwise.
public static TActiveRecord
# finder( string $className = __CLASS__ )

Returns the instance of a active record finder for a particular class. The finder objects are static instances for each ActiveRecord class. This means that event handlers bound to these finder instances are class wide. Create a new instance of the ActiveRecord class if you wish to bound the event handlers to object instance.

Returns the instance of a active record finder for a particular class. The finder objects are static instances for each ActiveRecord class. This means that event handlers bound to these finder instances are class wide. Create a new instance of the ActiveRecord class if you wish to bound the event handlers to object instance.

Parameters

$className
string
active record class name.

Returns

TActiveRecord
active record finder instance.
public static TActiveRecordManager
# getRecordManager( )

Gets the record manager for this object, the default is to call TActiveRecordManager::getInstance().

Gets the record manager for this object, the default is to call TActiveRecordManager::getInstance().

Returns

TActiveRecordManager
default active record manager.
public TActiveRecordGateway
# getRecordGateway( )

Returns

TActiveRecordGateway
record table gateway.
public boolean
# save( )

Saves the current record to the database, insert or update is automatically determined.

Saves the current record to the database, insert or update is automatically determined.

Returns

boolean
true if record was saved successfully, false otherwise.
public boolean
# delete( )

Deletes the current record from the database. Once deleted, this object can not be saved again in the same instance.

Deletes the current record from the database. Once deleted, this object can not be saved again in the same instance.

Returns

boolean
true if the record was deleted successfully, false otherwise.
public integer
# deleteByPk( mixed $keys )

Delete records by primary key. Usage:

Delete records by primary key. Usage:

$finder->deleteByPk($primaryKey); //delete 1 record
$finder->deleteByPk($key1,$key2,...); //delete multiple records
$finder->deleteByPk(array($key1,$key2,...)); //delete multiple records

For composite primary keys (determined from the table definitions):

$finder->deleteByPk(array($key1,$key2)); //delete 1 record

//delete multiple records
$finder->deleteByPk(array($key1,$key2), array($key3,$key4),...);

//delete multiple records
$finder->deleteByPk(array( array($key1,$key2), array($key3,$key4), .. ));

Parameters

$keys
mixed
primary key values.

Returns

integer
number of records deleted.
public
# deleteAllByPks( mixed $keys )

Alias for deleteByPk()

Alias for deleteByPk()

public integer
# deleteAll( string|TActiveRecordCriteria $criteria = null, mixed $parameters = array() )

Delete multiple records using a criteria.

Delete multiple records using a criteria.

Parameters

$criteria
string|TActiveRecordCriteria
SQL condition or criteria object.
$parameters
mixed
parameter values.

Returns

integer
number of records deleted.
protected TActiveRecord
# populateObject( array $data )

Populates a new record with the query result. This is a wrapper of TActiveRecord::createRecord().

Populates a new record with the query result. This is a wrapper of TActiveRecord::createRecord().

Parameters

$data
array
name value pair of record data

Returns

TActiveRecord
object record, null if data is empty.
protected array
# populateObjects( TDbDataReader $reader )

Parameters

$reader
TDbDataReader
data reader

Returns

array
the AR objects populated by the query result

Since

3.1.2
public static TActiveRecord
# createRecord( string $type, array $data )

Create an AR instance specified by the AR class name and initial data. If the initial data is empty, the AR object will not be created and null will be returned. (You should use the "new" operator to create the AR instance in that case.)

Create an AR instance specified by the AR class name and initial data. If the initial data is empty, the AR object will not be created and null will be returned. (You should use the "new" operator to create the AR instance in that case.)

Parameters

$type
string
the AR class name
$data
array
initial data to be populated into the AR object.

Returns

TActiveRecord
the initialized AR object. Null if the initial data is empty.

Since

3.1.2
public TActiveRecord
# find( string|TActiveRecordCriteria $criteria, mixed $parameters = array() )

Find one single record that matches the criteria.

Find one single record that matches the criteria.

Usage:

$finder->find('username = :name AND password = :pass',
                                        array(':name'=>$name, ':pass'=>$pass));
$finder->find('username = ? AND password = ?', array($name, $pass));
$finder->find('username = ? AND password = ?', $name, $pass);
//$criteria is of TActiveRecordCriteria
$finder->find($criteria); //the 2nd parameter for find() is ignored.

Parameters

$criteria
string|TActiveRecordCriteria
SQL condition or criteria object.
$parameters
mixed
parameter values.

Returns

TActiveRecord
matching record object. Null if no result is found.
public array
# findAll( string|TActiveRecordCriteria $criteria = null, mixed $parameters = array() )

Same as find() but returns an array of objects.

Same as find() but returns an array of objects.

Parameters

$criteria
string|TActiveRecordCriteria
SQL condition or criteria object.
$parameters
mixed
parameter values.

Returns

array
matching record objects. Empty array if no result is found.
public TActiveRecord.
# findByPk( mixed $keys )

Find one record using only the primary key or composite primary keys. Usage:

Find one record using only the primary key or composite primary keys. Usage:

$finder->findByPk($primaryKey);
$finder->findByPk($key1, $key2, ...);
$finder->findByPk(array($key1,$key2,...));

Parameters

$keys
mixed
primary keys

Returns

TActiveRecord.
Null if no result is found.
public array
# findAllByPks( mixed $keys )

Find multiple records matching a list of primary or composite keys.

Find multiple records matching a list of primary or composite keys.

For scalar primary keys:

$finder->findAllByPk($key1, $key2, ...);
$finder->findAllByPk(array($key1, $key2, ...));

For composite keys:

$finder->findAllByPk(array($key1, $key2), array($key3, $key4), ...);
$finder->findAllByPk(array(array($key1, $key2), array($key3, $key4), ...));

Parameters

$keys
mixed
primary keys

Returns

array
matching ActiveRecords. Empty array is returned if no result is found.
public TActiveRecord,
# findBySql( string $sql, array $parameters = array() )

Find records using full SQL, returns corresponding record object. The names of the column retrieved must be defined in your Active Record class.

Find records using full SQL, returns corresponding record object. The names of the column retrieved must be defined in your Active Record class.

Parameters

$sql
string
select SQL
$parameters
array
$parameters

Returns

TActiveRecord,
null if no result is returned.
public array
# findAllBySql( string $sql, array $parameters = array() )

Find records using full SQL, returns corresponding record object. The names of the column retrieved must be defined in your Active Record class.

Find records using full SQL, returns corresponding record object. The names of the column retrieved must be defined in your Active Record class.

Parameters

$sql
string
select SQL
$parameters
array
$parameters

Returns

array
matching active records. Empty array is returned if no result is found.
public array
# findAllByIndex( TActiveRecordCriteria $criteria, array $fields, array $values )

Fetches records using the sql clause "(fields) IN (values)", where fields is an array of column names and values is an array of values that the columns must have.

Fetches records using the sql clause "(fields) IN (values)", where fields is an array of column names and values is an array of values that the columns must have.

This method is to be used by the relationship handler.

Parameters

$criteria
TActiveRecordCriteria
additional criteria
$fields
array
field names to match with "(fields) IN (values)" sql clause.
$values
array
matching field values.

Returns

array
matching active records. Empty array is returned if no result is found.
public integer
# count( string|TActiveRecordCriteria $criteria = null, mixed $parameters = array() )

Find the number of records.

Find the number of records.

Parameters

$criteria
string|TActiveRecordCriteria
SQL condition or criteria object.
$parameters
mixed
parameter values.

Returns

integer
number of records.
protected TActiveRecordRelation,
# getRelationHandler( string $name, array $args = array() )

Returns the active record relationship handler for $RELATION with key value equal to the $property value.

Returns the active record relationship handler for $RELATION with key value equal to the $property value.

Parameters

$name
string
relationship/property name corresponding to keys in $RELATION array.
$args
array
method call arguments.

Returns

TActiveRecordRelation,
null if the context or the handler doesn't exist
protected TActiveRecordRelationContext
# createRelationContext( string $name )

Gets a static copy of the relationship context for given property (a key in $RELATIONS), returns null if invalid relationship. Keeps a null reference to all invalid relations called.

Gets a static copy of the relationship context for given property (a key in $RELATIONS), returns null if invalid relationship. Keeps a null reference to all invalid relations called.

Parameters

$name
string
relationship/property name corresponding to keys in $RELATION array.

Returns

TActiveRecordRelationContext
object containing information on the active record relationships for given property, null if invalid relationship

Since

3.1.2
protected boolean
# fetchResultsFor( string $property )

Tries to load the relationship results for the given property. The $property value should correspond to an entry key in the $RELATION array. This method can be used to lazy load relationships. <code> class TeamRecord extends TActiveRecord {
...

Tries to load the relationship results for the given property. The $property value should correspond to an entry key in the $RELATION array. This method can be used to lazy load relationships.

class TeamRecord extends TActiveRecord
{
    ...

private $_players;
    public static $RELATION=array
    (
        'players' => array(self::HAS_MANY, 'PlayerRecord'),
    );

    public function setPlayers($array)
    {
        $this->_players=$array;
    }

    public function getPlayers()
    {
        if($this->_players===null)
            $this->fetchResultsFor('players');
        return $this->_players;
    }
}
Usage example:
$team = TeamRecord::finder()->findByPk(1);
var_dump($team->players); //uses lazy load to fetch 'players' relation

Parameters

$property
string
relationship/property name corresponding to keys in $RELATION array.

Returns

boolean
true if relationship exists, false otherwise.

Since

3.1.2
public mixed
# __call( string $method, mixed $args )

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".

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:

$finder->findByName($name)
$finder->find('Name = ?', $name);
$finder->findByUsernameAndPassword($name,$pass); // OR may be used
$finder->findBy_Username_And_Password($name,$pass); // _OR_ may be used
$finder->find('Username = ? AND Password = ?', $name, $pass);
$finder->findAllByAge($age);
$finder->findAll('Age = ?', $age);
$finder->deleteAll('Name = ?', $name);
$finder->deleteByName($name);

Parameters

$method
string
method name that doesn't exist and is being called on the object
$args
mixed
method parameters

Returns

mixed
single record if method name starts with "findBy", 0 or more records if method name starts with "findAllBy"

Throws

TInvalidOperationException
If the property is not defined or read-only or method is undefined

Overrides

TComponent::__call()
public TActiveRecordInvalidFinderResult
# getInvalidFinderResult( )

Returns

TActiveRecordInvalidFinderResult
Defaults to 'TActiveRecordInvalidFinderResult::Null Null'.

Since

3.1.5

See

TActiveRecordManager::getInvalidFinderResult()
public
# setInvalidFinderResult( TActiveRecordInvalidFinderResult|null $value )

Define the way an active record finder react if an invalid magic-finder invoked

Define the way an active record finder react if an invalid magic-finder invoked

Parameters

$value
TActiveRecordInvalidFinderResult|null

Since

3.1.5

See

TActiveRecordManager::setInvalidFinderResult()
protected TSqlCriteria
# getRecordCriteria( string|TSqlCriteria $criteria, mixed $parameters, array $args = array() )

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.

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.

Parameters

$criteria
string|TSqlCriteria
sql criteria
$parameters
mixed
parameters passed by the user.
$args
array
additional parameters obtained from function_get_args().

Returns

TSqlCriteria
criteria object.
public
# onCreateCommand( TDataGatewayEventParameter $param )

Raised when a command is prepared and parameter binding is completed. The parameter object is TDataGatewayEventParameter of which the TDataGatewayEventParameter::getCommand Command property can be inspected to obtain the sql query to be executed.

Raised when a command is prepared and parameter binding is completed. The parameter object is TDataGatewayEventParameter of which the TDataGatewayEventParameter::getCommand Command property can be inspected to obtain the sql query to be executed.

Note well that the finder objects obtained from ActiveRecord::finder() method are static objects. This means that the event handlers are bound to a static finder object and not to each distinct active record object.

Parameters

$param
TDataGatewayEventParameter
public
# onExecuteCommand( TDataGatewayResultEventParameter $param )

Raised when a command is executed and the result from the database was returned. The parameter object is TDataGatewayResultEventParameter of which the TDataGatewayEventParameter::getResult Result property contains the data return from the database. The data returned can be changed by setting the TDataGatewayEventParameter::setResult Result property.

Raised when a command is executed and the result from the database was returned. The parameter object is TDataGatewayResultEventParameter of which the TDataGatewayEventParameter::getResult Result property contains the data return from the database. The data returned can be changed by setting the TDataGatewayEventParameter::setResult Result property.

Note well that the finder objects obtained from ActiveRecord::finder() method are static objects. This means that the event handlers are bound to a static finder object and not to each distinct active record object.

Parameters

$param
TDataGatewayResultEventParameter
public
# onInsert( TActiveRecordChangeEventParameter $param )

Raised before the record attempt to insert its data into the database. To prevent the insert operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false.

Raised before the record attempt to insert its data into the database. To prevent the insert operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false.

Parameters

$param
TActiveRecordChangeEventParameter
event parameter to be passed to the event handlers
public
# onDelete( TActiveRecordChangeEventParameter $param )

Raised before the record attempt to delete its data from the database. To prevent the delete operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false.

Raised before the record attempt to delete its data from the database. To prevent the delete operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false.

Parameters

$param
TActiveRecordChangeEventParameter
event parameter to be passed to the event handlers
public
# onUpdate( TActiveRecordChangeEventParameter $param )

Raised before the record attempt to update its data in the database. To prevent the update operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false.

Raised before the record attempt to update its data in the database. To prevent the update operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false.

Parameters

$param
TActiveRecordChangeEventParameter
event parameter to be passed to the event handlers
public mixed
# getColumnValue( string $columnName )

Retrieves the column value according to column name. This method is used internally.

Retrieves the column value according to column name. This method is used internally.

Parameters

$columnName
string
the column name (as defined in database schema)

Returns

mixed
the corresponding column value

Since

3.1.1
public
# setColumnValue( string $columnName, mixed $value )

Sets the column value according to column name. This method is used internally.

Sets the column value according to column name. This method is used internally.

Parameters

$columnName
string
the column name (as defined in database schema)
$value
mixed
the corresponding column value

Since

3.1.1
public array
# getRecordRelation( string $property )

Parameters

$property
string
relation property name

Returns

array
relation definition for the specified property

Since

3.1.2
public array
# getRecordRelations( )

Returns

array
all relation definitions declared in the AR class

Since

3.1.2
public boolean
# hasRecordRelation( string $property )

Parameters

$property
string
AR property name

Returns

boolean
whether a relation is declared for the specified AR property

Since

3.1.2
public array
# toArray( )

Return record data as array

Return record data as array

Returns

array
of column name and column values

Since

3.2.4
public JSON
# toJSON( )

Return record data as JSON

Return record data as JSON

Returns

JSON

Since

3.2.4
Methods inherited from TComponent
__destruct(), __isset(), __unset(), addParsedObject(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants summary
string BELONGS_TO 'BELONGS_TO'
#
string HAS_ONE 'HAS_ONE'
#
string HAS_MANY 'HAS_MANY'
#
string MANY_TO_MANY 'MANY_TO_MANY'
#
integer STATE_NEW 0
#
integer STATE_LOADED 1
#
integer STATE_DELETED 2
#
Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Properties summary
protected integer $_recordState 0
#

record state: 0 = new, 1 = loaded, 2 = deleted.

record state: 0 = new, 1 = loaded, 2 = deleted.

Since

3.1.2
public static array $COLUMN_MAPPING array()
#

This static variable defines the column mapping. The keys are physical column names as defined in database, and the values are logical column names as defined as public variable/property names for the corresponding active record class.

This static variable defines the column mapping. The keys are physical column names as defined in database, and the values are logical column names as defined as public variable/property names for the corresponding active record class.

Since

3.1.1
public static array $RELATIONS array()
#

This static variable defines the relationships. The keys are public variable/property names defined in the AR class. Each value is an array, e.g. array(self::HAS_MANY, 'PlayerRecord').

This static variable defines the relationships. The keys are public variable/property names defined in the AR class. Each value is an array, e.g. array(self::HAS_MANY, 'PlayerRecord').

Since

3.1.1
protected TDbConnection $_connection
#

database connection object.

database connection object.

protected TActiveRecordInvalidFinderResult $_invalidFinderResult null
#

Defaults to 'null'

Defaults to 'null'

Since

3.1.5
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO