Issues (3627)

Controller/Api/FocusApiController.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 MauticPlugin\MauticFocusBundle\Controller\Api;
13
14
use Mautic\ApiBundle\Controller\CommonApiController;
15
use Symfony\Component\HttpFoundation\Response;
16
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
17
18
/**
19
 * Class FocusApiController.
20
 */
21
class FocusApiController extends CommonApiController
22
{
23
    public function initialize(FilterControllerEvent $event)
24
    {
25
        parent::initialize($event);
26
27
        $this->model           = $this->getModel('focus');
28
        $this->entityClass     = 'MauticPlugin\MauticFocusBundle\Entity\Focus';
29
        $this->entityNameOne   = 'focus';
30
        $this->entityNameMulti = 'focus';
31
        $this->permissionBase  = 'focus:items';
32
        $this->dataInputMasks  = [
33
            'html'   => 'html',
34
            'editor' => 'html',
35
        ];
36
    }
37
38
    public function generateJsAction($id)
39
    {
40
        $focus = $this->model->getEntity($id);
41
        $view  = $this->view(['js' => $this->model->generateJavascript($focus)], Response::HTTP_OK);
0 ignored issues
show
The method generateJavascript() 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\MauticFocusBundle\Model\FocusModel. ( Ignorable by Annotation )

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

41
        $view  = $this->view(['js' => $this->model->/** @scrutinizer ignore-call */ generateJavascript($focus)], Response::HTTP_OK);
Loading history...
42
43
        return $this->handleView($view);
44
    }
45
}
46