-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDoctrineQueryConfig.php
More file actions
83 lines (69 loc) · 1.66 KB
/
DoctrineQueryConfig.php
File metadata and controls
83 lines (69 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
namespace Bilendi\DevExpressBundle\DataGrid\QueryHandler;
use Bilendi\DevExpressBundle\DataGrid\Expression\Visitable;
/**
* Class DoctrineQueryConfig.
*/
class DoctrineQueryConfig
{
/**
* @var array
*/
protected $fieldMapping = [];
/**
* @var Visitable[]
*/
protected $defaultFilters = [];
/**
* @var bool
*/
protected $caseSensitive = false;
/**
* DoctrineQueryConfig constructor.
*
* @param bool $caseSensitive
*/
public function __construct(array $fieldMapping = [], array $defaultFilters = [], $caseSensitive = false)
{
$this->fieldMapping = $fieldMapping;
$this->defaultFilters = $defaultFilters;
$this->caseSensitive = $caseSensitive;
}
/**
* @return Visitable[]
*/
public function getDefaultFilters(): array
{
return $this->defaultFilters;
}
public function setDefaultFilters(array $defaultFilters)
{
$this->defaultFilters = $defaultFilters;
}
public function getFieldMapping(): array
{
return $this->fieldMapping;
}
public function setFieldMapping(array $fieldMapping)
{
$this->fieldMapping = $fieldMapping;
}
/**
* @return string
*/
public function mapField(string $field)
{
if (array_key_exists($field, $this->fieldMapping)) {
return $this->fieldMapping[$field];
}
return $field;
}
public function isCaseSensitive(): bool
{
return $this->caseSensitive;
}
public function setCaseSensitive(bool $caseSensitive)
{
$this->caseSensitive = $caseSensitive;
}
}