special search for company list. Main model:CcxgCompanyXGroup
@param CDbCriteria $criteria
@return \CActiveDataProvider
512205
public function searchForList($criteria = null)
    {
        if (is_null($criteria)) {
            $criteria = new CDbCriteria;
        }

        $criteria->select = "t.*,ccgr_name,ccxg_ccgr_id";
        $criteria->compare('ccmp_id', $this->ccmp_id);
        $criteria->compare('ccmp_name', $this->ccmp_name, true);
        $criteria->compare('ccmp_ccnt_id', $this->ccmp_ccnt_id);
        $criteria->compare('ccmp_registrtion_no', $this->ccmp_registrtion_no, true);
        $criteria->compare('ccmp_vat_registrtion_no', $this->ccmp_vat_registrtion_no, true);
        $criteria->compare('ccmp_registration_date', $this->ccmp_registration_date);
        $criteria->compare('ccmp_registration_address', $this->ccmp_registration_address, true);
        $criteria->compare('ccmp_official_ccit_id', $this->ccmp_official_ccit_id);
        $criteria->compare('ccmp_official_address', $this->ccmp_official_address, true);
        $criteria->compare('ccmp_official_zip_code', $this->ccmp_official_zip_code, true);
        $criteria->compare('ccmp_office_ccit_id', $this->ccmp_office_ccit_id);
        $criteria->compare('ccmp_office_address', $this->ccmp_office_address, true);
        $criteria->compare('ccmp_office_zip_code', $this->ccmp_office_zip_code, true);
        $criteria->compare('ccmp_statuss', $this->ccmp_statuss);
        $criteria->compare('ccmp_description', $this->ccmp_description, true);
        $criteria->compare('ccmp_office_phone', $this->ccmp_office_phone, true);
        $criteria->compare('ccmp_office_email', $this->ccmp_office_email, true);
        $criteria->compare('ccmp_agreement_nr', $this->ccmp_agreement_nr, true);
        $criteria->compare('ccmp_agreement_date', $this->ccmp_agreement_date);
        $criteria->compare('ccmp_sys_ccmp_id', $this->ccmp_sys_ccmp_id);        
        $criteria->compare('ccxg_ccgr_id', $this->ccxg_ccgr_id);        

        $criteria->join  = " 
        LEFT OUTER JOIN ccxg_company_x_group 
            ON ccxg_ccmp_id = ccmp_id 
        LEFT OUTER JOIN ccgr_group 
            ON ccxg_ccgr_id = ccgr_id 
                   
        ";

        return new CActiveDataProvider('CcmpCompany', array(
            'criteria' => $criteria,
             'sort'=>array('defaultOrder'=>'ccmp_name'),
             'pagination'=>array('pageSize'=>50),

        ));        
    }
678039
public function findOneBy(array $criteria)
    {
        $query = $this->createQueryBuilder($criteria);
        if (!($object = $this->getOneOrNullResultFromQueryBuilder($query))) {
            $this->throwException('The resource was not found', 'not-found');
        }
        return $object;
    }
770782
protected function applyCriteria($criteria)
    {
        $query = $this->getQuery();
        $metadata = $this->getEntityMetadata();
        
        if (null !== $criteria) {
            switch (true) {
                case is_scalar($criteria):
                    $identifier = $metadata->getRawSQLName($metadata->getIdentifier());
                    $query->addConditions($identifier, $criteria);
                    break;
                
                case $criteria instanceof QueryBuilder\Select:
                    $criteria->setFromTable($metadata->getTableName());
                    $this->setQuery($criteria);
                    break;
                
                case (is_array($criteria) and count($criteria) > 0):
                    $query->addConditions(...$criteria);
                    break;
                
                default:
                    throw new NotSupportedException('It is impossible to determine the correct assignment criteria');
                    break;
            }
        }
        
        return $this;
    }
366476
public function init(BaseModelCriteria $criteria, DataFetcherInterface $dataFetcher = null)
    {
        $this->dbName = $criteria->getDbName();
        $this->setClass($criteria->getModelName());
        $this->setWith($criteria->getWith());
        $this->asColumns = $criteria->getAsColumns();
        $this->hasLimit = $criteria->getLimit() != -1;
        if ($dataFetcher) {
            $this->setDataFetcher($dataFetcher);
        }

        return $this;
    }
697668
public function getDatabaseSeriesData(Criteria $criteria)
    {
        $dbData = [];

        $res = $this->database->query("SELECT {$criteria->getValueField()} AS value,
calendar.week AS week,
calendar.month AS month,
calendar.year AS year,
{$this->getSeries($criteria->getSeries())}
{$criteria->getTableName()}.id
FROM {$criteria->getTableName()}
INNER JOIN calendar ON date({$criteria->getTableName()}.{$criteria->getTimeField()}) = calendar.date
    AND calendar.date >= '{$criteria->getStartDate()}'
	AND calendar.date <= '{$criteria->getEndDate()}'
    {$criteria->getJoin()}
WHERE
    {$criteria->getTableName()}.{$criteria->getTimeField()} >= '{$criteria->getStartDate()}' 
AND {$criteria->getTableName()}.{$criteria->getTimeField()} <= '{$criteria->getEndDate()}'
	{$criteria->getWhere()}
GROUP BY calendar.year,calendar.month,calendar.week" . $this->getGroupBy($criteria->getGroupBy()) . '
		');

        foreach ($res as $row) {
            $value = 0;
            if ($row->id != null) {
                $value = $row['value'];
            }
            $date = new \DateTime();
            $date->setISODate($row->year, $row->week);
            if (isset($row->name)) {
                $dbData[$row->name][$date->format('Y-m-d')] = $value;
            } else {
                $dbData[' '][$date->format('Y-m-d')] = $value;
            }
        }
        return $dbData;
    }
427232
public function findBy(array $criteria)
    {
        $found = [];
        foreach ($this->getCollection()->all() as $template) {
            foreach ($criteria as $criterium => $value) {
                $method = 'get'.ucfirst(strtolower($criterium));
                if (!method_exists($template, $method)) {
                    continue;
                }
                if ($template->$method() !== $value) {
                    continue 2;
                }
            }

            $found[] = $template;
        }

        return $found;
    }
1063981
public function search()
    {
        $criteria = new CDbCriteria;

        $criteria->compare('id', $this->id);
        $criteria->compare('name', $this->name, true);
        $criteria->compare('path', $this->path, true);
        $criteria->compare('extension', $this->extension, true);
        $criteria->compare('filename', $this->filename, true);
        $criteria->compare('mimeType', $this->mimeType, true);
        $criteria->compare('byteSize', $this->byteSize, true);
        $criteria->compare('hash', $this->hash, true);
        $criteria->compare('createdAt', $this->createdAt, true);

        return new CActiveDataProvider($this, array(
            'criteria' => $criteria,
        ));
    }
705717
private function createCriteriaQueryBuilder(Criteria $criteria, $prefix)
    {
        $qb = $this->createQueryBuilder($prefix);

        if ($criteria->count()) {
            $composite = $this->applyCriteriaToQueryBuilder($criteria, $qb, $prefix);

            if ($composite->count()) {
                $qb->where($composite);
            }
        }

        return $qb;
    }
1207099
private function factoryCallableCriteria($criteria)
    {
        if (!$this->isCallable($criteria)) {
            $criteria = function ($element, $key) use ($criteria) {
                return $element->fetch($criteria);
            };
        }

        return $criteria;
    }
911846
public function find(array $criteria): Engine
    {
        $this->findables = $this->initializeFindables();

        foreach ($criteria as $entry) {
            foreach ($this->findables as $engine) {
                if ($engine->canHandle($entry)) {
                    return $engine;
                }
            }
        }

        return $this->getNullObject();
    }
396654
public function search()
	{
		$criteria=new CDbCriteria;

		$criteria->compare('title',$this->title,true);

		$criteria->compare('status',$this->status);

		return new CActiveDataProvider('Post', array(
			'criteria'=>$criteria,
			'sort'=>array(
				'defaultOrder'=>'status, update_time DESC',
			),
		));
	}
336681
public function actionGet() 
	{
		if(Yii::app()->request->isAjaxRequest) {
			$criteria=new CDbCriteria; 
			$criteria->condition = 'publish = :publish'; 
			$criteria->params = array(':publish'=>1); 
			$criteria->order = 'creation_date DESC'; 

			$dataProvider = new CActiveDataProvider('OmmuWalls', array( 
				'criteria'=>$criteria, 
				'pagination'=>array( 
					'pageSize'=>5, 
				), 
			));
			
			$data = '';
			$wall = $dataProvider->getData();
			if(!empty($wall)) {
				foreach($wall as $key => $item) {
					$data .= Utility::otherDecode($this->renderPartial('_view', array('data'=>$item), true, false));
				}
			}
			$pager = OFunction::getDataProviderPager($dataProvider);
			if($pager[nextPage] != '0') {
				$summaryPager = 'Displaying 1-'.($pager[currentPage]*$pager[pageSize]).' of '.$pager[itemCount].' results.';
			} else {
				$summaryPager = 'Displaying 1-'.$pager[itemCount].' of '.$pager[itemCount].' results.';
			}
			$nextPager = $pager['nextPage'] != 0 ? Yii::app()->controller->createUrl('get', array($pager['pageVar']=>$pager['nextPage'])) : 0;
			
			$return = array(
				'type'=>0,
				'data'=>$data,
				'pager'=>$pager,
				'summarypager'=>$summaryPager,
				'nextpage'=>$nextPager,
			);
			echo CJSON::encode($return);
			
		} else
			throw new CHttpException(404, Yii::t('phrase', 'The requested page does not exist.'));
	}
910037
public function init(ModelCriteria $criteria)
    {
        $this->dbName = $criteria->getDbName();
        $this->setClass($criteria->getModelName());
        $this->setWith($criteria->getWith());
        $this->asColumns = $criteria->getAsColumns();
        $this->hasLimit = $criteria->getLimit() != 0;

        return $this;
    }
468814
private function openCriteria(array &$criteria, $connector = self::LOGICAL_AND)
    {
        $criteria[] = array('bracket' => self::BRACKET_OPEN,
            'connector' => $connector);

        return $this;
    }
236261
public static function fromExisting(IChartCriteria $criteria) : ChartCriteria
    {
        $self = new self($criteria->getStructure());

        $self->conditions = $criteria->getConditions();
        $self->orderings  = $criteria->getOrderings();

        return $self;
    }
1229415
public function matching(Criteria $criteria)
    {
        $visitor = new QueryExpressionVisitor($this->createQueryBuilder());
        $queryBuilder = $this->createQueryBuilder();

        if ($criteria->getWhereExpression() !== null) {
            $expr = $visitor->dispatch($criteria->getWhereExpression());
            $queryBuilder->setQueryArray($expr->getQuery());
        }

        if ($criteria->getMaxResults() !== null) {
            $queryBuilder->limit($criteria->getMaxResults());
        }

        if ($criteria->getFirstResult() !== null) {
            $queryBuilder->skip($criteria->getFirstResult());
        }

        if ($criteria->getOrderings() !== null) {
            $queryBuilder->sort($criteria->getOrderings());
        }

        // @TODO: wrap around a specialized Collection for efficient count on large collections
        return new ArrayCollection($queryBuilder->getQuery()->execute()->toArray());
    }
85365
public function getFacetsByCriteria(Criteria $criteria)
    {
        $query = new Query();
        $query->setSize(0);

        $filter = $this->createFilterFromCriteria($criteria);

        $priorityFacet = new Facet\Terms('priorities');
        $priorityFacet->setField('priority');
        if ($filter->getFilters()) {
            $priorityFacet->setFilter($filter);
        }
        $query->addFacet($priorityFacet);

        $typeFacet = new Facet\Terms('types');
        $typeFacet->setField('type');
        if ($filter->getFilters()) {
            $typeFacet->setFilter($filter);
        }
        $query->addFacet($typeFacet);

        $channelFacet = new Facet\Terms('channels');
        $channelFacet->setField('channel');
        if ($filter->getFilters()) {
            $channelFacet->setFilter($filter);
        }
        $query->addFacet($channelFacet);

        $roleFacet = new Facet\Terms('roles');
        $roleFacet->setField('role');
        if ($filter->getFilters()) {
            $roleFacet->setFilter($filter);
        }
        $query->addFacet($roleFacet);

        $resultSet = $this->getType()->search($query);
        $facets = $resultSet->getFacets();

        $filterSets = [
            'priorities' => array_column($facets['priorities']['terms'], 'term'),
            'types' => array_column($facets['types']['terms'], 'term'),
            'channels' => array_column($facets['channels']['terms'], 'term'),
            'roles' => array_column($facets['roles']['terms'], 'term'),
        ];

        return $filterSets;
    }