ClassSuggestQuery::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Mdiyakov\DoctrineSolrBundle\Query\Suggest;
4
5
use Mdiyakov\DoctrineSolrBundle\Query\Suggest\Solarium\Query;
6
use Mdiyakov\DoctrineSolrBundle\Schema\Schema;
7
use Solarium\Client;
8
9
class ClassSuggestQuery extends AbstractSuggestQuery
10
{
11
12
    /**
13
     * @var string[][]
14
     */
15
    private $entityConfig;
16
17
    /**
18
     * @param Client $client
19
     * @param Schema $schema
20
     * @param string[][] $entityConfig
21
     */
22
    public function __construct(Client $client, Schema $schema, $entityConfig)
23
    {
24
        parent::__construct($client, $schema);
25
        $this->entityConfig = $entityConfig;
26
    }
27
28
    /**
29
     * @param Query $solrQuery
30
     */
31
    protected function initDiscriminatorConditions(Query $solrQuery)
32
    {
33
        $discriminatorConfigField = $this->getSchema()->getDiscriminatorConfigField();
34
        $solrQuery->setContextFieldQuery(
35
            $discriminatorConfigField->getValue($this->entityConfig)
36
        );
37
    }
38
}