Completed
Push — master ( 6c15b7...f5f8be )
by Sander
12:00
created

Controller/RulesAdminListController.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\LeadGenerationBundle\Controller;
4
5
use Kunstmaan\AdminListBundle\AdminList\Configurator\AdminListConfiguratorInterface;
6
use Kunstmaan\AdminListBundle\Controller\AdminListController;
7
use Kunstmaan\LeadGenerationBundle\AdminList\RulesAdminListConfigurator;
8
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
9
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
10
use Symfony\Component\HttpFoundation\Request;
11
12
class RulesAdminListController extends AdminListController
13
{
14
    /**
15
     * @var RulesAdminListConfigurator
16
     */
17
    private $configurator;
18
19
    /**
20
     * @return AdminListConfiguratorInterface
21
     */
22
    public function getAdminListConfigurator($id)
23
    {
24
        if (!isset($this->configurator)) {
25
            $this->configurator = new RulesAdminListConfigurator($this->getEntityManager(), null, $id);
26
        }
27
28
        return $this->configurator;
29
    }
30
31
    /**
32
     * The detail action
33
     *
34
     * @Route("/{popup}/rules", requirements={"popup" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_rule_abstractrule_detail")
35
     */
36
    public function detailAction(Request $request, $popup)
37
    {
38
        return parent::doIndexAction($this->getAdminListConfigurator($popup), $request);
39
    }
40
41
    /**
42
     * The add action
43
     *
44
     * @Route("/{popup}/add", requirements={"popup" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_rule_abstractrule_add")
45
     * @Method({"GET", "POST"})
46
     *
47
     * @return array
0 ignored issues
show
Should the return type not be \Symfony\Component\HttpFoundation\Response?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
48
     */
49
    public function addAction(Request $request, $popup)
50
    {
51
        $type = $request->get('type');
52
53
        return parent::doAddAction($this->getAdminListConfigurator($popup), $type, $request);
54
    }
55
56
    /**
57
     * The edit action
58
     *
59
     * @param int $id
60
     *
61
     * @Route("/{popup}/rules/{id}/edit", requirements={"popup" = "\d+", "rule" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_rule_abstractrule_edit")
62
     * @Method({"GET", "POST"})
63
     *
64
     * @return array
0 ignored issues
show
Should the return type not be \Symfony\Component\HttpFoundation\Response?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
65
     */
66
    public function editAction(Request $request, $id, $popup)
67
    {
68
        return parent::doEditAction($this->getAdminListConfigurator($popup), $id, $request);
69
    }
70
71
    /**
72
     * The delete action
73
     *
74
     * @param int $id
75
     *
76
     * @Route("/{popup}/rules/{id}/delete", requirements={"popup" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_rule_abstractrule_delete")
77
     * @Method({"GET", "POST"})
78
     *
79
     * @return array
0 ignored issues
show
Should the return type not be \Symfony\Component\HttpFoundation\Response?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
80
     */
81
    public function deleteAction(Request $request, $id, $popup)
82
    {
83
        return parent::doDeleteAction($this->getAdminListConfigurator($popup), $id, $request);
84
    }
85
}
86