Passed
Branch request-processor (31ada2)
by Iakov
02:59
created

GetQueryBuilderStep   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setDoctrine() 0 3 1
A requiresBefore() 0 5 1
A execute() 0 3 1
1
<?php
2
3
namespace Kami\ApiCoreBundle\RequestProcessor\Step\Common;
4
5
use Doctrine\Bundle\DoctrineBundle\Registry;
6
use Kami\ApiCoreBundle\RequestProcessor\Step\AbstractStep;
7
8
class GetQueryBuilderStep extends AbstractStep
9
{
10
    /**
11
     * @var Registry
12
     */
13
    private $doctrine;
14
15
    public function execute()
16
    {
17
        return $this->createResponse(['query_builder' => $this->doctrine->getManager()->createQueryBuilder()]);
18
    }
19
20
    public function setDoctrine(Registry $doctrine)
21
    {
22
        $this->doctrine = $doctrine;
23
    }
24
25
    public function requiresBefore()
26
    {
27
        return [
28
            GetReflectionFromRequestStep::class,
29
            ValidateResourceAccessStep::class
30
        ];
31
    }
32
}