1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Kunstmaan\LeadGenerationBundle\Controller; |
4
|
|
|
|
5
|
|
|
use Kunstmaan\AdminBundle\Entity\EntityInterface; |
6
|
|
|
use Kunstmaan\AdminListBundle\AdminList\Configurator\AdminListConfiguratorInterface; |
7
|
|
|
use Kunstmaan\AdminListBundle\AdminList\ItemAction\SimpleItemAction; |
8
|
|
|
use Kunstmaan\AdminListBundle\Controller\AdminListController; |
9
|
|
|
use Kunstmaan\LeadGenerationBundle\AdminList\PopupAdminListConfigurator; |
10
|
|
|
use Symfony\Component\Routing\Annotation\Route; |
11
|
|
|
use Symfony\Component\HttpFoundation\Request; |
12
|
|
|
|
13
|
|
|
class PopupsAdminListController extends AdminListController |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var AdminListConfiguratorInterface |
17
|
|
|
*/ |
18
|
|
|
private $configurator; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @return AdminListConfiguratorInterface |
22
|
|
|
*/ |
23
|
|
|
public function getAdminListConfigurator($listAction = false) |
24
|
|
|
{ |
25
|
|
|
if (!isset($this->configurator)) { |
26
|
|
|
$this->configurator = new PopupAdminListConfigurator($this->getEntityManager()); |
27
|
|
|
|
28
|
|
|
if ($listAction) { |
29
|
|
|
$create_route = function (EntityInterface $item) { |
30
|
|
|
return array( |
31
|
|
|
'path' => 'kunstmaanleadgenerationbundle_admin_rule_abstractrule_detail', |
32
|
|
|
'params' => array('popup' => $item->getId()), |
33
|
|
|
); |
34
|
|
|
}; |
35
|
|
|
$this->configurator->addItemAction(new SimpleItemAction($create_route, 'th-list', 'Manage rules')); |
36
|
|
|
} |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
return $this->configurator; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* The index action |
44
|
|
|
* |
45
|
|
|
* @Route("/", name="kunstmaanleadgenerationbundle_admin_popup_abstractpopup") |
46
|
|
|
*/ |
47
|
|
|
public function indexAction(Request $request) |
48
|
|
|
{ |
49
|
|
|
return parent::doIndexAction($this->getAdminListConfigurator(true), $request); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* The delete action |
54
|
|
|
* |
55
|
|
|
* @param int $id |
56
|
|
|
* |
57
|
|
|
* @Route("/{id}/delete", requirements={"id" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_popup_abstractpopup_delete", methods={"GET", "POST"}) |
58
|
|
|
* |
59
|
|
|
* @return array |
60
|
|
|
*/ |
61
|
|
|
public function deleteAction(Request $request, $id) |
62
|
|
|
{ |
63
|
|
|
return parent::doDeleteAction($this->getAdminListConfigurator(), $id, $request); |
|
|
|
|
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* The edit action |
68
|
|
|
* |
69
|
|
|
* @param int $id |
70
|
|
|
* |
71
|
|
|
* @Route("/{id}/edit", requirements={"id" = "\d+"}, name="kunstmaanleadgenerationbundle_admin_popup_abstractpopup_edit", methods={"GET", "POST"}) |
72
|
|
|
* |
73
|
|
|
* @return array |
74
|
|
|
*/ |
75
|
|
|
public function editAction(Request $request, $id) |
76
|
|
|
{ |
77
|
|
|
return parent::doEditAction($this->getAdminListConfigurator(), $id, $request); |
|
|
|
|
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* The add action |
82
|
|
|
* |
83
|
|
|
* @Route("/add", name="kunstmaanleadgenerationbundle_admin_popup_abstractpopup_add", methods={"GET", "POST"}) |
84
|
|
|
* |
85
|
|
|
* @return array |
86
|
|
|
*/ |
87
|
|
|
public function addAction(Request $request) |
88
|
|
|
{ |
89
|
|
|
$type = $request->get('type'); |
90
|
|
|
|
91
|
|
|
return parent::doAddAction($this->getAdminListConfigurator(), $type, $request); |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.