Completed
Push — pull-request/7609 ( 4ccf63...393b85 )
by Kamil
146:59 queued 125: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
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
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 Sylius\Bundle\CoreBundle\Doctrine\ORM;
13
14
use Doctrine\ORM\EntityManager;
15
use Doctrine\ORM\Mapping;
16
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
17
18
/**
19
 * @author Kamil Kokot <[email protected]>
20
 */
21
class AttributeRepository extends EntityRepository
22
{
23
    /**
24
     * @var AssociationHydrator
25
     */
26
    protected $associationHydrator;
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    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...
32
    {
33
        parent::__construct($em, $class);
34
35
        $this->associationHydrator = new AssociationHydrator($this->_em, $class);
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function findAll()
42
    {
43
        $attributes = parent::findAll();
44
45
        $this->associationHydrator->hydrateAssociation($attributes, 'translations');
46
47
        return $attributes;
48
    }
49
}
50