Completed
Push — master ( 68f942...d69058 )
by Rafał
18:18
created

OrganizationRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A findOneByName() 0 6 1
A findOneByCode() 0 6 1
A findAvailable() 0 11 1
1
<?php
2
3
/**
4
 * This file is part of the Superdesk Web Publisher MultiTenancy Bundle.
5
 *
6
 * Copyright 2016 Sourcefabric z.ú. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2016 Sourcefabric z.ú.
12
 * @license http://www.superdesk.org/license
13
 */
14
namespace SWP\Bundle\MultiTenancyBundle\Doctrine\PHPCR;
15
16
use SWP\Bundle\StorageBundle\Doctrine\ODM\PHPCR\DocumentRepository;
17
use SWP\Component\MultiTenancy\Repository\OrganizationRepositoryInterface;
18
19
class OrganizationRepository extends DocumentRepository implements OrganizationRepositoryInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function findOneByName($name)
25
    {
26
        return $this->findOneBy([
27
            'name' => $name,
28
        ]);
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function findOneByCode($code)
35
    {
36
        return $this->findOneBy([
37
            'code' => $code,
38
        ]);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function findAvailable()
45
    {
46
        return $this
47
            ->createQueryBuilder('t')
48
                ->where()
49
                    ->eq()
50
                        ->field('t.enabled')->literal(true)
51
                    ->end()
52
                ->end()
53
            ->getQuery();
54
    }
55
}
56