Completed
Push — master ( 0eab77...b2f729 )
by Paul
05:35
created

BusinessPropertyRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 31
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getByClassname() 0 9 1
A getByBusinessEntity() 0 9 1
1
<?php
2
3
namespace Victoire\Bundle\BusinessEntityBundle\Entity;
4
5
use Doctrine\ORM\EntityRepository;
6
use Doctrine\ORM\Query\Expr;
7
use Victoire\Bundle\CoreBundle\Repository\StateFullRepositoryTrait;
8
9
/**
10
 * The BusinessProperty Repository.
11
 */
12
class BusinessPropertyRepository extends EntityRepository
13
{
14
    use StateFullRepositoryTrait;
15
    protected $mainAlias = 'businessproperty';
16
17
    /**
18
     * @param array $classname
19
     */
20
    public function getByClassname($classname)
21
    {
22
        $this->getInstance()
23
            ->join('Victoire\Bundle\ORMBusinessEntityBundle\Entity\ORMBusinessEntity', 'be', Expr\Join::WITH, 'businessproperty.businessEntity = be.id')
24
            ->where('be.class = :classname')
25
            ->setParameter(':classname', $classname);
26
27
        return $this;
28
    }
29
30
    /**
31
     * @param array $businessEntity
32
     */
33
    public function getByBusinessEntity($businessEntity)
34
    {
35
        $this->getInstance()
36
            ->join('Victoire\Bundle\BusinessEntityBundle\Entity\BusinessEntity', 'be', Expr\Join::WITH, 'businessproperty.businessEntity = be.id')
37
            ->where('be.name = :businessEntity')
38
            ->setParameter(':businessEntity', $businessEntity);
39
40
        return $this;
41
    }
42
}
43