Completed
Pull Request — master (#167)
by
unknown
17:54
created

ProfileManager::findAllProfiles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\SettingsBundle\Service;
13
14
use ONGR\ElasticsearchBundle\Service\Manager;
15
use ONGR\ElasticsearchDSL\Query\MatchAllQuery;
16
17
class ProfileManager
18
{
19
    /**
20
     * @var Manager
21
     */
22
    private $manager;
23
24
    /**
25
     * ProfileFinder constructor.
26
     * @param Manager $manager
27
     */
28
    public function __construct(Manager $manager)
29
    {
30
        $this->manager = $manager;
31
    }
32
33
    /**
34
     * Finds all profiles
35
     */
36
    public function findAllProfiles()
37
    {
38
        $repo = $this->manager->getRepository('ONGRSettingsBundle:Profile');
39
        $search = $repo->createSearch();
40
        $search->addQuery(new MatchAllQuery());
41
        return $repo->execute($search, 'array');
42
    }
43
}