CActiveRecordMetaData
Package | system.db.ar |
---|---|
Inheritance | class CActiveRecordMetaData |
Since | 1.0 |
Version | $Id: CActiveRecord.php 2230 2010-06-25 20:16:41Z qiang.xue $ |
CActiveRecordMetaData represents the meta-data for an Active Record class.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
attributeDefaults | array | attribute default values | CActiveRecordMetaData |
columns | array | table columns | CActiveRecordMetaData |
relations | array | list of relations | CActiveRecordMetaData |
tableSchema | CDbTableSchema | the table schema information | CActiveRecordMetaData |
Public Methods
Method | Description | Defined By |
---|---|---|
__construct() | Constructor. | CActiveRecordMetaData |
addRelation() | Adds a relation. | CActiveRecordMetaData |
hasRelation() | Checks if there is a relation with specified name defined. | CActiveRecordMetaData |
removeRelation() | Deletes a relation with specified name. | CActiveRecordMetaData |
Property Details
attributeDefaults
property
public array $attributeDefaults;
attribute default values
columns
property
public array $columns;
table columns
relations
property
public array $relations;
list of relations
tableSchema
property
public CDbTableSchema $tableSchema;
the table schema information
Method Details
__construct()
method
public void __construct(CActiveRecord $model)
| ||
$model | CActiveRecord | the model instance |
Constructor.
addRelation()
method
(available since v1.1.2)
public void addRelation(string $name, array $config)
| ||
$name | string | $name Name of the relation. |
$config | array | $config Relation parameters. |
{return} | void |
Adds a relation.
$config is an array with three elements:
relation type, the related active record class and the foreign key.
hasRelation()
method
(available since v1.1.2)
public boolean hasRelation(string $name)
| ||
$name | string | $name Name of the relation. |
{return} | boolean |
Checks if there is a relation with specified name defined.
removeRelation()
method
(available since v1.1.2)
public void removeRelation(string $name)
| ||
$name | string | $name |
{return} | void |
Deletes a relation with specified name.