Completed
Push — product-create-admin ( 72e5ba )
by Kamil
23:08
created

AttributeRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Sylius\Bundle\CoreBundle\Doctrine\ORM;
4
5
use Doctrine\ORM\EntityManager;
6
use Doctrine\ORM\Mapping;
7
use Sylius\Bundle\AttributeBundle\Doctrine\ORM\AttributeRepository as BaseAttributeRepository;
8
9
/**
10
 * @author Kamil Kokot <[email protected]>
11
 */
12
class AttributeRepository extends BaseAttributeRepository
13
{
14
    /**
15
     * @var AssociationHydrator
16
     */
17
    protected $associationHydrator;
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function __construct(EntityManager $em, Mapping\ClassMetadata $class)
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $em. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
23
    {
24
        parent::__construct($em, $class);
25
26
        $this->associationHydrator = new AssociationHydrator($this->_em, $class);
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function findAll()
33
    {
34
        $attributes = parent::findAll();
35
36
        $this->associationHydrator->hydrateAssociation($attributes, 'translations');
37
38
        return $attributes;
39
    }
40
}
41