public function getAllProfiles()
    {
        $profiles = [];

        $search = $this->repo->createSearch();
        $filter = new BoolQuery();
        $filter->add(new TermQuery('type', 'experiment'), BoolQuery::MUST_NOT);
        $topHitsAgg = new TopHitsAggregation('documents', 20);
        $termAgg = new TermsAggregation('profiles', 'profile.profile');
        $filterAgg = new FilterAggregation('filter', $filter);
        $termAgg->addAggregation($topHitsAgg);
        $filterAgg->addAggregation($termAgg);
        $search->addAggregation($filterAgg);

        $result = $this->repo->findDocuments($search);

        /** @var Setting $activeProfiles */
        $activeProfiles = $this->getValue($this->activeProfilesSettingName, []);

        /** @var AggregationValue $agg */
        foreach ($result->getAggregation('filter')->getAggregation('profiles') as $agg) {
            $settings = [];
            $docs = $agg->getAggregation('documents');
            foreach ($docs['hits']['hits'] as $doc) {
                $settings[] = $doc['_source']['name'];
            }
            $name = $agg->getValue('key');
            $profiles[] = [
                'active' => $activeProfiles ? in_array($agg->getValue('key'), (array)$activeProfiles) : false,
                'name' => $name,
                'settings' => implode(', ', $settings),
            ];
        }

        return $profiles;
    }
public function getAllProfiles()
    {
        $profiles = [];

        $search = $this->repo->createSearch();
        $filter = new BoolQuery();
        $filter->add(new TermQuery('type', 'experiment'), BoolQuery::MUST_NOT);
        $topHitsAgg = new TopHitsAggregation('documents', 20);
        $termAgg = new TermsAggregation('profiles', 'profile.profile');
        $filterAgg = new FilterAggregation('filter', $filter);
        $termAgg->addAggregation($topHitsAgg);
        $filterAgg->addAggregation($termAgg);
        $search->addAggregation($filterAgg);

        $result = $this->repo->findDocuments($search);

        /** @var Setting $activeProfiles */
        $activeProfiles = $this->getValue($this->activeProfilesSettingName, []);

        /** @var AggregationValue $agg */
        foreach ($result->getAggregation('filter')->getAggregation('profiles') as $agg) {
            $settings = [];
            $docs = $agg->getAggregation('documents');
            foreach ($docs['hits']['hits'] as $doc) {
                $settings[] = $doc['_source']['name'];
            }
            $name = $agg->getValue('key');
            $profiles[] = [
                'active' => $activeProfiles ? in_array($agg->getValue('key'), (array)$activeProfiles) : false,
                'name' => $name,
                'settings' => implode(', ', $settings),
            ];
        }

        return $profiles;
    }
public function getAllProfiles ( ) { $ profiles = [ ] ; $ search = $ this -> repo -> createSearch ( ) ; $ filter = new BoolQuery ( ) ; $ filter -> add ( new TermQuery ( 'type' , 'experiment' ) , BoolQuery :: MUST_NOT ) ; $ topHitsAgg = new TopHitsAggregation ( 'documents' , 20 ) ; $ termAgg = new TermsAggregation ( 'profiles' , 'profile.profile' ) ; $ filterAgg = new FilterAggregation ( 'filter' , $ filter ) ; $ termAgg -> addAggregation ( $ topHitsAgg ) ; $ filterAgg -> addAggregation ( $ termAgg ) ; $ search -> addAggregation ( $ filterAgg ) ; $ result = $ this -> repo -> findDocuments ( $ search ) ; /** @var Setting $activeProfiles */ $ activeProfiles = $ this -> getValue ( $ this -> activeProfilesSettingName , [ ] ) ; /** @var AggregationValue $agg */ foreach ( $ result -> getAggregation ( 'filter' ) -> getAggregation ( 'profiles' ) as $ agg ) { $ settings = [ ] ; $ docs = $ agg -> getAggregation ( 'documents' ) ; foreach ( $ docs [ 'hits' ] [ 'hits' ] as $ doc ) { $ settings [ ] = $ doc [ '_source' ] [ 'name' ] ; } $ name = $ agg -> getValue ( 'key' ) ; $ profiles [ ] = [ 'active' => $ activeProfiles ? in_array ( $ agg -> getValue ( 'key' ) , ( array ) $ activeProfiles ) : false , 'name' => $ name , 'settings' => implode ( ', ' , $ settings ) , ] ; } return $ profiles ; }
Get all full profile information.

@return array
Get all full profile information .