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\TaggingBundle\Controller; |
||
4 | |||
5 | use Kunstmaan\AdminListBundle\AdminList\Configurator\AdminListConfiguratorInterface; |
||
6 | use Kunstmaan\AdminListBundle\Controller\AdminListController; |
||
7 | use Kunstmaan\TaggingBundle\AdminList\TagAdminListConfigurator; |
||
8 | use Symfony\Component\Routing\Annotation\Route; |
||
9 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
||
10 | use Symfony\Component\HttpFoundation\Request; |
||
11 | |||
12 | class TagAdminListController extends AdminListController |
||
13 | { |
||
14 | /** |
||
15 | * @var AdminListConfiguratorInterface |
||
16 | */ |
||
17 | private $configurator; |
||
18 | |||
19 | /** |
||
20 | * @return AdminListConfiguratorInterface |
||
21 | */ |
||
22 | public function getAdminListConfigurator() |
||
23 | { |
||
24 | if (!isset($this->configurator)) { |
||
25 | $this->configurator = new TagAdminListConfigurator($this->getEntityManager()); |
||
0 ignored issues
–
show
|
|||
26 | } |
||
27 | |||
28 | return $this->configurator; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @Route("/", name="kunstmaantaggingbundle_admin_tag") |
||
33 | * @Template("@KunstmaanAdminList/Default/list.html.twig") |
||
34 | */ |
||
35 | public function indexAction(Request $request) |
||
36 | { |
||
37 | return parent::doIndexAction($this->getAdminListConfigurator(), $request); |
||
0 ignored issues
–
show
$this->getAdminListConfigurator() of type object<Kunstmaan\AdminLi...tConfiguratorInterface> is not a sub-type of object<Kunstmaan\AdminLi...tAdminListConfigurator> . It seems like you assume a concrete implementation of the interface Kunstmaan\AdminListBundl...stConfiguratorInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.
Loading history...
|
|||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @Route("/add", name="kunstmaantaggingbundle_admin_tag_add", methods={"GET", "POST"}) |
||
42 | * @Template("@KunstmaanAdminList/Default/add.html.twig") |
||
43 | * |
||
44 | * @return array |
||
45 | */ |
||
46 | public function addAction(Request $request) |
||
47 | { |
||
48 | return parent::doAddAction($this->getAdminListConfigurator(), null, $request); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @Route("/{id}/edit", requirements={"id" = "\d+"}, name="kunstmaantaggingbundle_admin_tag_edit", methods={"GET", "POST"}) |
||
53 | * @Template("@KunstmaanAdminList/Default/edit.html.twig") |
||
54 | */ |
||
55 | public function editAction(Request $request, $id) |
||
56 | { |
||
57 | return parent::doEditAction($this->getAdminListConfigurator(), $id, $request); |
||
0 ignored issues
–
show
$this->getAdminListConfigurator() of type object<Kunstmaan\AdminLi...tConfiguratorInterface> is not a sub-type of object<Kunstmaan\AdminLi...tAdminListConfigurator> . It seems like you assume a concrete implementation of the interface Kunstmaan\AdminListBundl...stConfiguratorInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.
Loading history...
|
|||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @Route("/{id}/delete", requirements={"id" = "\d+"}, name="kunstmaantaggingbundle_admin_tag_delete", methods={"GET", "POST"}) |
||
62 | * @Template("@KunstmaanAdminList/Default/delete.html.twig") |
||
63 | */ |
||
64 | public function deleteAction(Request $request, $id) |
||
65 | { |
||
66 | return parent::doDeleteAction($this->getAdminListConfigurator(), $id, $request); |
||
0 ignored issues
–
show
$this->getAdminListConfigurator() of type object<Kunstmaan\AdminLi...tConfiguratorInterface> is not a sub-type of object<Kunstmaan\AdminLi...tAdminListConfigurator> . It seems like you assume a concrete implementation of the interface Kunstmaan\AdminListBundl...stConfiguratorInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.
Loading history...
|
|||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @Route("/autocomplete.{_format}", name="kunstmaantaggingbundle_admin_tag_autocomplete", defaults={"_format" = "json"}) |
||
71 | * @Template("@KunstmaanTagging/Tags/autocomplete.json.twig") |
||
72 | * |
||
73 | * @param \Symfony\Component\HttpFoundation\Request $request |
||
74 | * |
||
75 | * @return array |
||
76 | */ |
||
77 | public function autocompleteAction(Request $request) |
||
78 | { |
||
79 | $search = $request->get('term'); |
||
80 | $em = $this->getDoctrine()->getManager(); |
||
81 | $qb = $em->getRepository('KunstmaanTaggingBundle:Tag')->createQueryBuilder('n') |
||
82 | ->where('n.name LIKE :search') |
||
83 | ->orderBy('n.name', 'ASC') |
||
84 | ->setParameter('search', '%' . $search . '%'); |
||
85 | $tags = $qb->getQuery()->getResult(); |
||
86 | |||
87 | return array('tags' => $tags); |
||
88 | } |
||
89 | } |
||
90 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.