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

TenantRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
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 33
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A findOneBySubdomain() 0 6 1
A findOneByCode() 0 6 1
A findAvailableTenants() 0 7 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\TenantRepositoryInterface;
18
19
class TenantRepository extends DocumentRepository implements TenantRepositoryInterface
0 ignored issues
show
Bug introduced by
There is one abstract method findBySubdomain in this class; you could implement it, or declare this class as abstract.
Loading history...
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function findOneBySubdomain($subdomain)
25
    {
26
        return $this->findOneBy([
27
            'subdomain' => $subdomain,
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 findAvailableTenants()
45
    {
46
        return $this
47
            ->createQueryBuilder('t')
48
            ->getQuery()
49
            ->getResult();
50
    }
51
}
52