for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace app\models\query;
use Yii;
use yii\db\ActiveQuery;
use app\models\User;
/**
* ActiveQuery for User
*/
class UserQuery extends ActiveQuery
{
* Select only active
*
* @return yii\db\ActiveQuery
public function active()
$this->andWhere(['status' => User::STATUS_ACTIVE]);
return $this;
}
* Select only blocked
public function blocked()
$this->andWhere(['status' => User::STATUS_BLOCKED]);
* Select only deleted
public function deleted()
$this->andWhere(['status' => User::STATUS_DELETED]);
* `Like` search for value in the field
* @param string $field
* @param string $value
public function like($field, $value)
$this->andWhere(['like', $field, $value]);