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

ViewTranslationRepository::getTranslationForView()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
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