Issues (3627)

CategoryBundle/Controller/AjaxController.php (1 issue)

1
<?php
2
3
/*
4
 * @copyright   2014 Mautic Contributors. All rights reserved
5
 * @author      Mautic
6
 *
7
 * @link        http://mautic.org
8
 *
9
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
 */
11
12
namespace Mautic\CategoryBundle\Controller;
13
14
use Mautic\CoreBundle\Controller\AjaxController as CommonAjaxController;
15
use Mautic\CoreBundle\Helper\InputHelper;
16
use Symfony\Component\HttpFoundation\Request;
17
18
/**
19
 * Class AjaxController.
20
 */
21
class AjaxController extends CommonAjaxController
22
{
23
    /**
24
     * @return \Symfony\Component\HttpFoundation\JsonResponse
25
     */
26
    protected function categoryListAction(Request $request)
27
    {
28
        $bundle    = InputHelper::clean($request->query->get('bundle'));
29
        $filter    = InputHelper::clean($request->query->get('filter'));
30
        $results   = $this->getModel('category')->getLookupResults($bundle, $filter, 10);
0 ignored issues
show
The method getLookupResults() does not exist on Mautic\CoreBundle\Model\AbstractCommonModel. It seems like you code against a sub-type of Mautic\CoreBundle\Model\AbstractCommonModel such as MauticPlugin\MauticSocialBundle\Model\TweetModel or Mautic\DynamicContentBun...del\DynamicContentModel or Mautic\NotificationBundle\Model\NotificationModel or Mautic\ChannelBundle\Model\MessageModel or Mautic\PageBundle\Model\PageModel or Mautic\EmailBundle\Model\EmailModel or Mautic\AssetBundle\Model\AssetModel or Mautic\CategoryBundle\Model\CategoryModel or Mautic\LeadBundle\Model\FieldModel or Mautic\SmsBundle\Model\SmsModel or Mautic\UserBundle\Model\UserModel or Mautic\LeadBundle\Model\LeadModel or Mautic\LeadBundle\Model\CompanyModel. ( Ignorable by Annotation )

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

30
        $results   = $this->getModel('category')->/** @scrutinizer ignore-call */ getLookupResults($bundle, $filter, 10);
Loading history...
31
        $dataArray = [];
32
        foreach ($results as $r) {
33
            $dataArray[] = [
34
                'label' => $r['title']." ({$r['id']})",
35
                'value' => $r['id'],
36
            ];
37
        }
38
39
        return $this->sendJsonResponse($dataArray);
40
    }
41
}
42