system system.base system.caching system.caching.dependencies system.collections system.console system.db system.db.ar system.db.schema system.db.schema.mssql system.db.schema.mysql system.db.schema.oci system.db.schema.pgsql system.db.schema.sqlite system.i18n system.i18n.gettext system.logging system.utils system.validators system.web system.web.actions system.web.auth system.web.filters system.web.helpers system.web.renderers system.web.services system.web.widgets system.web.widgets.captcha system.web.widgets.pagers

CActiveFinder

system.db.ar
继承 class CActiveFinder » CComponent
可用自 1.0
版本 $Id$
CActiveFinder implements eager loading and lazy loading of related active records.

When used in eager loading, this class provides the same set of find methods as CActiveRecord.

公共属性

隐藏继承的属性

属性类型描述被定义在
baseLimited boolean whether the base model has limit or offset. CActiveFinder
joinAll boolean join all tables all at once. CActiveFinder

公共方法

隐藏继承的方法

方法描述被定义在
__call() Calls the named method which is not a class method. CComponent
__construct() Constructor. CActiveFinder
__get() Returns a property value, an event handler list or a behavior based on its name. CComponent
__isset() Checks if a property value is null. CComponent
__set() Sets value of a component property. CComponent
__unset() Sets a component property to be null. CComponent
asa() Returns the named behavior object. CComponent
attachBehavior() Attaches a behavior to this component. CComponent
attachBehaviors() Attaches a list of behaviors to the component. CComponent
attachEventHandler() Attaches an event handler to an event. CComponent
canGetProperty() Determines whether a property can be read. CComponent
canSetProperty() Determines whether a property can be set. CComponent
count() This is the relational version of CActiveRecord::count(). CActiveFinder
detachBehavior() Detaches a behavior from the component. CComponent
detachBehaviors() Detaches all behaviors from the component. CComponent
detachEventHandler() Detaches an existing event handler. CComponent
disableBehavior() Disables an attached behavior. CComponent
disableBehaviors() Disables all behaviors attached to this component. CComponent
enableBehavior() Enables an attached behavior. CComponent
enableBehaviors() Enables all behaviors attached to this component. CComponent
find() This is the relational version of CActiveRecord::find(). CActiveFinder
findAll() This is the relational version of CActiveRecord::findAll(). CActiveFinder
findAllByAttributes() This is the relational version of CActiveRecord::findAllByAttributes(). CActiveFinder
findAllByPk() This is the relational version of CActiveRecord::findAllByPk(). CActiveFinder
findAllBySql() This is the relational version of CActiveRecord::findAllBySql(). CActiveFinder
findByAttributes() This is the relational version of CActiveRecord::findByAttributes(). CActiveFinder
findByPk() This is the relational version of CActiveRecord::findByPk(). CActiveFinder
findBySql() This is the relational version of CActiveRecord::findBySql(). CActiveFinder
getEventHandlers() Returns the list of attached event handlers for an event. CComponent
hasEvent() Determines whether an event is defined. CComponent
hasEventHandler() Checks whether the named event has attached handlers. CComponent
hasProperty() Determines whether a property is defined. CComponent
lazyFind() Finds the related objects for the specified active record. CActiveFinder
raiseEvent() Raises an event. CComponent
together() Uses the most aggressive join approach. CActiveFinder

属性详情

baseLimited 属性 (自版本 v1.0.2 可用)
public boolean $baseLimited;

whether the base model has limit or offset. This property is internally used.

joinAll 属性 (自版本 v1.0.2 可用)
public boolean $joinAll;

join all tables all at once. Defaults to false. This property is internally used.

方法详情

__construct() 方法
public void __construct(CActiveRecord $model, mixed $with)
$model CActiveRecord the model that initiates the active finding process
$with mixed the relation names to be actively looked for

Constructor. A join tree is built up based on the declared relationships between active record classes.

count() 方法 (自版本 v1.0.3 可用)
public void count($condition='', $params=array ( ))
$condition
$params

This is the relational version of CActiveRecord::count().

find() 方法
public void find($condition='', $params=array ( ))
$condition
$params

This is the relational version of CActiveRecord::find().

findAll() 方法
public void findAll($condition='', $params=array ( ))
$condition
$params

This is the relational version of CActiveRecord::findAll().

findAllByAttributes() 方法
public void findAllByAttributes($attributes, $condition='', $params=array ( ))
$attributes
$condition
$params

This is the relational version of CActiveRecord::findAllByAttributes().

findAllByPk() 方法
public void findAllByPk($pk, $condition='', $params=array ( ))
$pk
$condition
$params

This is the relational version of CActiveRecord::findAllByPk().

findAllBySql() 方法
public void findAllBySql($sql, $params=array ( ))
$sql
$params

This is the relational version of CActiveRecord::findAllBySql().

findByAttributes() 方法
public void findByAttributes($attributes, $condition='', $params=array ( ))
$attributes
$condition
$params

This is the relational version of CActiveRecord::findByAttributes().

findByPk() 方法
public void findByPk($pk, $condition='', $params=array ( ))
$pk
$condition
$params

This is the relational version of CActiveRecord::findByPk().

findBySql() 方法
public void findBySql($sql, $params=array ( ))
$sql
$params

This is the relational version of CActiveRecord::findBySql().

lazyFind() 方法
public void lazyFind(CActiveRecord $baseRecord)
$baseRecord CActiveRecord the base record whose related objects are to be loaded

Finds the related objects for the specified active record. This method is internally invoked by CActiveRecord to support lazy loading.

together() 方法 (自版本 v1.0.2 可用)
public CActiveFinder together(boolean $ignoreLimit=true)
$ignoreLimit boolean whether we should enforce join even when a limit option is placed on the primary table query. Defaults to true. If false, we would still use two queries when there is a HAS_MANY/MANY_MANY relation and the primary table has a LIMIT option. This parameter is available since version 1.0.3.
{return} CActiveFinder the finder object

Uses the most aggressive join approach. By default, several join statements may be generated in order to avoid fetching duplicated data. By calling this method, all tables will be joined together all at once.