Failed Conditions
Branch issue#666 (91903a)
by Guilherme
08:25
created

OrganizationMembersController   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 51
ccs 0
cts 30
cp 0
rs 10
c 0
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A memberSearchAction() 0 20 2
A listMembersAction() 0 18 3
1
<?php
2
3
namespace LoginCidadao\OAuthBundle\Controller;
4
5
use Symfony\Component\HttpFoundation\Request;
6
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
8
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
9
use LoginCidadao\CoreBundle\Helper\GridHelper;
10
11
class OrganizationMembersController extends Controller
12
{
13
14
    /**
15
     * @Route("/organizations/members/filter", name="lc_organizations_members_filter")
16
     * @Template()
17
     */
18
    public function memberSearchAction(Request $request)
19
    {
20
        $grid = new GridHelper();
21
        $grid->setId('developer-filter-grid')
22
            ->setPerPage(5)
23
            ->setMaxResult(5)
24
            ->setInfiniteGrid(true)
25
            ->setRouteParams(array('ac_data'))
26
            ->setRoute('lc_organizations_members_filter');
27
28
        $parms = $request->get('ac_data');
29
        if (isset($parms['username'])) {
30
            $query = $this->getDoctrine()
31
                ->getRepository('LoginCidadaoCoreBundle:Person')
32
                ->getUserSearchQuery($parms['username']);
33
34
            $grid->setQueryBuilder($query);
0 ignored issues
show
Deprecated Code introduced by
The function LoginCidadao\CoreBundle\...lper::setQueryBuilder() has been deprecated: since version 1.1.0 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

34
            /** @scrutinizer ignore-deprecated */ $grid->setQueryBuilder($query);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
35
        }
36
37
        return array('grid' => $grid->createView($request));
38
    }
39
40
    /**
41
     * @Route("/organizations/members", name="lc_organizations_members")
42
     * @Template()
43
     */
44
    public function listMembersAction(Request $request)
45
    {
46
        $grid = new GridHelper();
47
        $grid->setId('developer-grid')
48
            ->setPerPage(5)
49
            ->setMaxResult(5)
50
            ->setInfiniteGrid(true)
51
            ->setRouteParams(array('ac_data'))
52
            ->setRoute('lc_organizations_members');
53
54
        $parms = $request->get('ac_data');
55
        if (isset($parms['person_id']) && !empty($parms['person_id'])) {
56
            $query = $this->getDoctrine()
57
                ->getRepository('LoginCidadaoCoreBundle:Person')
58
                ->getFindByIdIn($parms['person_id']);
59
            $grid->setQueryBuilder($query);
0 ignored issues
show
Deprecated Code introduced by
The function LoginCidadao\CoreBundle\...lper::setQueryBuilder() has been deprecated: since version 1.1.0 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

59
            /** @scrutinizer ignore-deprecated */ $grid->setQueryBuilder($query);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
60
        }
61
        return array('grid' => $grid->createView($request));
62
    }
63
}
64