Completed
Push — master ( 9745cb...81e988 )
by Paul
06:43
created

ViewTranslationRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getTranslationForView() 0 8 2
1
<?php
2
3
namespace Victoire\Bundle\I18nBundle\Repository;
4
5
use Doctrine\ORM\EntityRepository;
6
use Victoire\Bundle\BusinessPageBundle\Entity\VirtualBusinessPage;
7
use Victoire\Bundle\CoreBundle\Entity\View;
8
use Victoire\Bundle\CoreBundle\Repository\StateFullRepositoryTrait;
9
10
/**
11
 * The ViewTranslation repository.
12
 */
13
class ViewTranslationRepository extends EntityRepository
14
{
15
    use StateFullRepositoryTrait;
16
17
    public function getTranslationForView(View $view)
18
    {
19
        if ($view instanceof VirtualBusinessPage) {
20
            $view = $view->getTemplate();
21
        }
22
23
        return $this->findBy(['object' => $view]);
24
    }
25
}
26