CBaseActiveRelation
CBaseActiveRelation is the base class for all active relations.
Public Properties
Hide inherited properties
| Property | Type | Description | Defined By |
| className |
string |
name of the related active record class |
CBaseActiveRelation |
| condition |
string |
WHERE clause. |
CBaseActiveRelation |
| foreignKey |
string |
the foreign key in this relation |
CBaseActiveRelation |
| group |
string |
GROUP BY clause. |
CBaseActiveRelation |
| having |
string |
HAVING clause. |
CBaseActiveRelation |
| join |
string |
how to join with other tables. |
CBaseActiveRelation |
| name |
string |
name of the related object |
CBaseActiveRelation |
| order |
string |
ORDER BY clause. |
CBaseActiveRelation |
| params |
array |
the parameters that are to be bound to the condition. |
CBaseActiveRelation |
| select |
mixed |
list of column names (an array, or a string of names separated by commas) to be selected. |
CBaseActiveRelation |
Property Details
public string $className;
name of the related active record class
public string $condition;
WHERE clause. For CActiveRelation descendant classes, column names
referenced in the condition should be disambiguated with prefix 'relationName.'.
public string $foreignKey;
the foreign key in this relation
public string $group;
GROUP BY clause. For CActiveRelation descendant classes, column names
referenced in this property should be disambiguated with prefix 'relationName.'.
public string $having;
HAVING clause. For CActiveRelation descendant classes, column names
referenced in this property should be disambiguated with prefix 'relationName.'.
public string $join;
how to join with other tables. This refers to the JOIN clause in an SQL statement.
For example, 'LEFT JOIN users ON users.id=authorID'.
public string $name;
name of the related object
public string $order;
ORDER BY clause. For CActiveRelation descendant classes, column names
referenced in this property should be disambiguated with prefix 'relationName.'.
public array $params;
the parameters that are to be bound to the condition.
The keys are parameter placeholder names, and the values are parameter values.
public mixed $select;
list of column names (an array, or a string of names separated by commas) to be selected.
Do not quote or prefix the column names unless they are used in an expression.
In that case, you should prefix the column names with 'relationName.'.
Method Details
|
public void __construct(string $name, string $className, string $foreignKey, array $options=array (
))
|
| $name |
string |
name of the relation |
| $className |
string |
name of the related active record class |
| $foreignKey |
string |
foreign key for this relation |
| $options |
array |
additional options (name=>value). The keys must be the property names of this class. |
Constructor.
|
public void mergeWith(array $criteria, boolean $fromScope=false)
|
| $criteria |
array |
the dynamically specified criteria |
| $fromScope |
boolean |
whether the criteria to be merged is from scopes |
Merges this relation with a criteria specified dynamically.