1 | <?php |
||
2 | |||
3 | /* |
||
4 | * @copyright 2016 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\CoreBundle\Entity; |
||
13 | |||
14 | use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder; |
||
15 | |||
16 | /** |
||
17 | * Trait FiltersEntityTrait. |
||
18 | */ |
||
19 | trait FiltersEntityTrait |
||
20 | { |
||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private $filters = []; |
||
25 | |||
26 | protected static function addFiltersMetadata(ClassMetadataBuilder $builder) |
||
27 | { |
||
28 | $builder->createField('filters', 'array') |
||
29 | ->columnName('filters') |
||
30 | ->nullable() |
||
31 | ->build(); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @return array |
||
36 | */ |
||
37 | public function getFilters() |
||
38 | { |
||
39 | return $this->filters ?: []; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @param array $filters |
||
44 | * |
||
45 | * @return $this |
||
46 | */ |
||
47 | public function setFilters($filters) |
||
48 | { |
||
49 | $this->isChanged('filters', $filters); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
50 | $this->filters = $filters; |
||
51 | |||
52 | return $this; |
||
53 | } |
||
54 | } |
||
55 |