Completed
Push — master ( e6c0c9...d841f8 )
by Jeroen
35:52 queued 19:21
created

AdminList/PopupAdminListConfigurator.php (5 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\AdminList;
4
5
use Doctrine\ORM\EntityManager;
6
use Kunstmaan\AdminBundle\Helper\Security\Acl\AclHelper;
7
use Kunstmaan\AdminListBundle\AdminList\Configurator\AbstractDoctrineORMAdminListConfigurator;
8
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM;
9
10
class PopupAdminListConfigurator extends AbstractDoctrineORMAdminListConfigurator
11
{
12
    /**
13
     * @param EntityManager $em        The entity manager
14
     * @param AclHelper     $aclHelper The acl helper
15
     */
16 View Code Duplication
    public function __construct(EntityManager $em, AclHelper $aclHelper = null)
17
    {
18
        parent::__construct($em, $aclHelper);
19
20
        $this->setListTemplate('KunstmaanLeadGenerationBundle:AdminList:popup-list.html.twig');
21
        $this->setEditTemplate('KunstmaanLeadGenerationBundle:AdminList:popup-edit.html.twig');
22
        $this->setAddTemplate('KunstmaanLeadGenerationBundle:AdminList:popup-edit.html.twig');
23
    }
24
25
    /**
26
     * Configure the visible columns
27
     */
28
    public function buildFields()
29
    {
30
        $this->addField('id', 'kuma_lead_generation.popup.list.header.id', true);
0 ignored issues
show
true is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
31
        $this->addField('name', 'kuma_lead_generation.popup.list.header.name', true);
0 ignored issues
show
true is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
32
        $this->addField('classname', 'kuma_lead_generation.popup.list.header.type', false);
0 ignored issues
show
false is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
33
        $this->addField('htmlId', 'kuma_lead_generation.popup.list.header.html_id', true);
0 ignored issues
show
true is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
34
        $this->addField('ruleCount', 'kuma_lead_generation.popup.list.header.rule_count', false);
0 ignored issues
show
false is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
35
    }
36
37
    /**
38
     * Build filters for admin list
39
     */
40
    public function buildFilters()
41
    {
42
        $this->addFilter('name', new ORM\StringFilterType('name'), 'kuma_lead_generation.popup.list.filter.name');
43
        $this->addFilter('htmlId', new ORM\StringFilterType('htmlId'), 'kuma_lead_generation.popup.list.filter.html_id');
44
    }
45
46
    /**
47
     * Get bundle name
48
     *
49
     * @return string
50
     */
51
    public function getBundleName()
52
    {
53
        return 'KunstmaanLeadGenerationBundle';
54
    }
55
56
    /**
57
     * Get entity name
58
     *
59
     * @return string
60
     */
61
    public function getEntityName()
62
    {
63
        return 'Popup\AbstractPopup';
64
    }
65
66
    /**
67
     * @param object|array $item
68
     *
69
     * @return bool
70
     */
71
    public function canEdit($item)
72
    {
73
        return true;
74
    }
75
76
    /**
77
     * Configure if it's possible to delete the given $item
78
     *
79
     * @param object|array $item
80
     *
81
     * @return bool
82
     */
83
    public function canDelete($item)
84
    {
85
        return true;
86
    }
87
88
    /**
89
     * Configure if it's possible to add new items
90
     *
91
     * @return bool
92
     */
93
    public function canAdd()
94
    {
95
        return true;
96
    }
97
}
98