Maslosoft Mangan API
Interface ScopeManagerInterface
Direct known implementers
Author: Piotr Maselkowski
Located at Interfaces/ScopeManagerInterface.php
Methods summary
public
array
|
#
scopes( )
Returns the declaration of named scopes. A named scope represents a query criteria that can be chained together with other named scopes and applied to a query. This method should be overridden by child classes to declare named scopes for the particular document classes. For example, the following code declares two named scopes: 'recently' and 'published'. return array( 'published'=>array( 'conditions'=>array( 'status'=>array('==', 1), ), ), 'recently'=>array( 'sort'=>array('create_time'=>Criteria::SortDesc), 'limit'=>5, ), ); If the above scopes are declared in a 'Post' model, we can perform the following queries: $posts=Post::model()->published()->findAll(); $posts=Post::model()->published()->recently()->findAll(); $posts=Post::model()->published()->published()->recently()->find(); |
public
array
|
#
defaultScope( )
Returns the default named scope that should be implicitly applied to all queries for this model. Note, default scope only applies to SELECT queries. It is ignored for INSERT, UPDATE and DELETE queries. The default implementation simply returns an empty array. You may override this method if the model needs to be queried with some default criteria (e.g. only active records should be returned). |
public
|
|
public
|
#
apply(
Apply scopes to criteria, will create criteria object if not provided and pass it by reference |
public
|
|
public
|