You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
1.6 KiB
82 lines
1.6 KiB
13 years ago
|
<?php
|
||
|
/**
|
||
|
* ActiveFinder class file.
|
||
|
*
|
||
|
* @author Qiang Xue <qiang.xue@gmail.com>
|
||
|
* @link http://www.yiiframework.com/
|
||
|
* @copyright Copyright © 2008-2012 Yii Software LLC
|
||
|
* @license http://www.yiiframework.com/license/
|
||
|
*/
|
||
|
|
||
|
namespace yii\db\ar;
|
||
|
|
||
|
use yii\db\dao\BaseQuery;
|
||
|
|
||
|
/**
|
||
|
* @author Qiang Xue <qiang.xue@gmail.com>
|
||
|
* @since 2.0
|
||
|
*/
|
||
|
class BaseActiveQuery extends BaseQuery
|
||
|
{
|
||
|
/**
|
||
|
* @var string the name of the ActiveRecord class.
|
||
|
*/
|
||
|
public $modelClass;
|
||
|
/**
|
||
|
* @var array list of relations that this query should be performed with
|
||
|
*/
|
||
|
public $with;
|
||
|
/**
|
||
|
* @var string the table alias to be used for query
|
||
|
*/
|
||
|
public $tableAlias;
|
||
|
/**
|
||
|
* @var string the name of the column that the result should be indexed by.
|
||
|
* This is only useful when the query result is returned as an array.
|
||
|
*/
|
||
|
public $indexBy;
|
||
|
/**
|
||
|
* @var boolean whether to return each record as an array. If false (default), an object
|
||
|
* of [[modelClass]] will be created to represent each record.
|
||
|
*/
|
||
|
public $asArray;
|
||
|
/**
|
||
|
* @var array list of scopes that should be applied to this query
|
||
|
*/
|
||
|
public $scopes;
|
||
|
|
||
|
public function asArray($value = true)
|
||
|
{
|
||
|
$this->asArray = $value;
|
||
|
return $this;
|
||
|
}
|
||
|
|
||
|
public function with()
|
||
|
{
|
||
|
$this->with = func_get_args();
|
||
|
if (isset($this->with[0]) && is_array($this->with[0])) {
|
||
|
// the parameter is given as an array
|
||
|
$this->with = $this->with[0];
|
||
|
}
|
||
|
return $this;
|
||
|
}
|
||
|
|
||
|
public function indexBy($column)
|
||
|
{
|
||
|
$this->indexBy = $column;
|
||
|
return $this;
|
||
|
}
|
||
|
|
||
|
public function tableAlias($value)
|
||
|
{
|
||
|
$this->tableAlias = $value;
|
||
|
return $this;
|
||
|
}
|
||
|
|
||
|
public function scopes($names)
|
||
|
{
|
||
|
$this->scopes = $names;
|
||
|
return $this;
|
||
|
}
|
||
|
}
|