BaseController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDoctrineMongoDB() 0 8 2
A getDocumentManager() 0 4 1
1
<?php
2
3
namespace Admingenerator\GeneratorBundle\Controller\DoctrineODM;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6
use Symfony\Component\HttpFoundation\Request;
7
8
/**
9
 * A base controller for DoctrineODM
10
 *
11
 * @author cedric Lombardot
12
 *
13
 */
14
abstract class BaseController extends Controller
15
{
16
    /**
17
     * @var Request
18
     */
19
    protected $request;
20
21
    /**
22
     * @return \Doctrine\Bundle\MongoDBBundle\ManagerRegistry
23
     */
24
    protected function getDoctrineMongoDB()
25
    {
26
        if (!$this->container->has('doctrine_mongodb')) {
27
            throw new \LogicException('The DoctrineMongoDBBundle is not registered in your application.');
28
        }
29
30
        return $this->container->get('doctrine_mongodb');
31
    }
32
33
    /**
34
     * @return \Doctrine\ODM\MongoDB\DocumentManager
35
     */
36
    protected function getDocumentManager()
37
    {
38
        return $this->get('doctrine.odm.mongodb.document_manager');
39
    }
40
}
41