AttributeOptionReader::getRepository()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Actualys\Bundle\DrupalCommerceConnectorBundle\Reader\ORM;
4
5
use Pim\Bundle\BaseConnectorBundle\Reader\ORM\EntityReader;
6
use Actualys\Bundle\DrupalCommerceConnectorBundle\Entity\Repository\AttributeRepository;
7
use Doctrine\ORM\EntityManager;
8
9
/**
10
 * Class AttributeOptionReader
11
 * @package Actualys\Bundle\DrupalCommerceConnectorBundle\Reader\ORM
12
 */
13
class AttributeOptionReader extends EntityReader
14
{
15
    /**
16
     * @var AttributeRepository $repository
17
     */
18
    protected $repository;
19
20
    /**
21
     * @param EntityManager       $em
22
     * @param string              $className
23
     * @param AttributeRepository $repository
24
     */
25
    public function __construct(
26
      EntityManager $em,
27
      $className,
28
      AttributeRepository $repository
29
    ) {
30
        parent::__construct($em, $className);
31
32
        $this->repository = $repository;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function getQuery()
39
    {
40
        if (!$this->query) {
41
            $this->query = $this->getRepository()
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getRepository()->...edOptions()->getQuery() of type object<Doctrine\ORM\Query> is incompatible with the declared type object<Pim\Bundle\BaseCo...Doctrine\AbstractQuery> of property $query.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
42
              ->findMultiValuedOptions()
43
              ->getQuery();
44
        }
45
46
        return $this->query;
47
    }
48
49
    /**
50
     * Get the custom category repository
51
     * @return AttributeRepository
52
     */
53
    protected function getRepository()
54
    {
55
        return $this->repository;
56
    }
57
}
58