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 Symfony\Component\Routing\Annotation\Route;
9
use Symfony\Component\HttpFoundation\Request;
10
11
class RulesAdminListController extends AdminListController
12
{
13
    /**
14
     * @var RulesAdminListConfigurator
15
     */
16
    private $configurator;
17
18
    /**
19
     * @return AdminListConfiguratorInterface
20
     */
21
    public function getAdminListConfigurator($id)
22
    {
23
        if (!isset($this->configurator)) {
24
            $this->configurator = new RulesAdminListConfigurator($this->getEntityManager(), null, $id);
25
        }
26
27
        return $this->configurator;
28
    }
29
30
    /**
31
     * The detail action
32
     *
33
     * @Route("/{popup}/rules", requirements={"popup" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_rule_abstractrule_detail")
34
     */
35
    public function detailAction(Request $request, $popup)
36
    {
37
        return parent::doIndexAction($this->getAdminListConfigurator($popup), $request);
38
    }
39
40
    /**
41
     * The add action
42
     *
43
     * @Route("/{popup}/add", requirements={"popup" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_rule_abstractrule_add", methods={"GET", "POST"})
44
     *
45
     * @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...
46
     */
47
    public function addAction(Request $request, $popup)
48
    {
49
        $type = $request->get('type');
50
51
        return parent::doAddAction($this->getAdminListConfigurator($popup), $type, $request);
52
    }
53
54
    /**
55
     * The edit action
56
     *
57
     * @param int $id
58
     *
59
     * @Route("/{popup}/rules/{id}/edit", requirements={"popup" = "\d+", "rule" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_rule_abstractrule_edit", methods={"GET", "POST"})
60
     *
61
     * @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...
62
     */
63
    public function editAction(Request $request, $id, $popup)
64
    {
65
        return parent::doEditAction($this->getAdminListConfigurator($popup), $id, $request);
66
    }
67
68
    /**
69
     * The delete action
70
     *
71
     * @param int $id
72
     *
73
     * @Route("/{popup}/rules/{id}/delete", requirements={"popup" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_rule_abstractrule_delete", methods={"GET", "POST"})
74
     *
75
     * @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...
76
     */
77
    public function deleteAction(Request $request, $id, $popup)
78
    {
79
        return parent::doDeleteAction($this->getAdminListConfigurator($popup), $id, $request);
80
    }
81
}
82