Browse Source

updated interface and trait php-doc in yii\ar

[ci skip]
tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
51faa62eca
  1. 2
      framework/yii/ar/ActiveQueryInterface.php
  2. 25
      framework/yii/ar/ActiveQueryTrait.php
  3. 2
      framework/yii/ar/ActiveRelationInterface.php
  4. 11
      framework/yii/ar/ActiveRelationTrait.php

2
framework/yii/ar/ActiveQueryInterface.php

@ -9,7 +9,7 @@ namespace yii\ar;
use yii\db\QueryInterface;
/**
* ActiveQueryInterface defines the common interface to be implemented by active record relation classes.
* ActiveQueryInterface defines the common interface to be implemented by active record query classes.
*
* A class implementing this interface should also use [[ActiveQueryTrait]].
*

25
framework/yii/ar/ActiveQueryTrait.php

@ -10,30 +10,7 @@ namespace yii\ar;
use yii\db\ActiveRecord;
/**
* ActiveQueryTrait implements the common set of methods that are used by DB queries associated with an Active Record class.
*
* ActiveQuery mainly provides the following methods to retrieve the query results:
*
* - [[one()]]: returns a single record populated with the first row of data.
* - [[all()]]: returns all records based on the query results.
* - [[count()]]: returns the number of records.
* - [[scalar()]]: returns the value of the first column in the first row of the query result.
* - [[exists()]]: returns a value indicating whether the query result has data or not.
*
* Because ActiveQuery extends from [[Query]], one can use query methods, such as [[where()]],
* [[orderBy()]] to customize the query options.
*
* ActiveQuery also provides the following additional query options:
*
* - [[with()]]: list of relations that this query should be performed with.
* - [[indexBy()]]: the name of the column by which the query result should be indexed.
* - [[asArray()]]: whether to return each record as an array.
*
* These options can be configured using methods of the same name. For example:
*
* ~~~
* $customers = Customer::find()->with('orders')->asArray()->all();
* ~~~
* ActiveQueryTrait implements the common methods and properties for active record query classes.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Carsten Brandt <mail@cebe.cc>

2
framework/yii/ar/ActiveRelationInterface.php

@ -10,6 +10,8 @@ namespace yii\ar;
/**
* ActiveRelationInterface defines the common interface to be implemented by active record relation classes.
*
* A class implementing this interface should also use [[ActiveRelationTrait]].
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0

11
framework/yii/ar/ActiveRelationTrait.php

@ -11,16 +11,7 @@ use yii\base\InvalidConfigException;
use yii\db\ActiveRecord;
/**
* ActiveRelation represents a relation between two Active Record classes.
*
* ActiveRelation instances are usually created by calling [[ActiveRecord::hasOne()]] and
* [[ActiveRecord::hasMany()]]. An Active Record class declares a relation by defining
* a getter method which calls one of the above methods and returns the created ActiveRelation object.
*
* A relation is specified by [[link]] which represents the association between columns
* of different tables; and the multiplicity of the relation is indicated by [[multiple]].
*
* If a relation involves a pivot table, it may be specified by [[via()]] or [[viaTable()]] method.
* ActiveRelationTrait implements the common methods and properties for active record relation classes.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Carsten Brandt <mail@cebe.cc>

Loading…
Cancel
Save