common/models/query/ArticleCategoryQuery.php
<?php
/*
* This file is part of the HomeFinanceV2 project.
*
* (c) Rafalsky.com <http://github.com/Rafalsky/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace common\models\query;
use common\models\ArticleCategory;
use yii\db\ActiveQuery;
class ArticleCategoryQuery extends ActiveQuery
{
/**
* @return $this
*/
public function active()
{
$this->andWhere(['status' => ArticleCategory::STATUS_ACTIVE]);
return $this;
}
/**
* @return $this
*/
public function noParents()
{
$this->andWhere('{{%article_category}}.parent_id IS NULL');
return $this;
}
}