1 | <?php |
||
35 | 1 | class Doctrine extends \Nette\Object implements IDataSource |
|
36 | { |
||
37 | /** @var \Doctrine\ORM\QueryBuilder */ |
||
38 | protected $qb; |
||
39 | |||
40 | /** @var array Map column to the query builder */ |
||
41 | protected $filterMapping; |
||
42 | |||
43 | /** @var array Map column to the query builder */ |
||
44 | protected $sortMapping; |
||
45 | |||
46 | /** @var bool use OutputWalker in Doctrine Paginator */ |
||
47 | protected $useOutputWalkers; |
||
48 | |||
49 | /** @var bool fetch join collection in Doctrine Paginator */ |
||
50 | protected $fetchJoinCollection = TRUE; |
||
51 | |||
52 | /** @var array */ |
||
53 | protected $rand; |
||
54 | |||
55 | /** |
||
56 | * If $sortMapping is not set and $filterMapping is set, |
||
57 | * $filterMapping will be used also as $sortMapping. |
||
58 | * @param \Doctrine\ORM\QueryBuilder $qb |
||
59 | * @param array $filterMapping Maps columns to the DQL columns |
||
60 | * @param array $sortMapping Maps columns to the DQL columns |
||
61 | */ |
||
62 | public function __construct(\Doctrine\ORM\QueryBuilder $qb, array $filterMapping = NULL, array $sortMapping = NULL) |
||
72 | |||
73 | /** |
||
74 | * @param bool $useOutputWalkers |
||
75 | * @return \Grido\DataSources\Doctrine |
||
76 | */ |
||
77 | public function setUseOutputWalkers($useOutputWalkers) |
||
82 | |||
83 | /** |
||
84 | * @param bool $fetchJoinCollection |
||
85 | * @return \Grido\DataSources\Doctrine |
||
86 | */ |
||
87 | public function setFetchJoinCollection($fetchJoinCollection) |
||
92 | |||
93 | /** |
||
94 | * @return \Doctrine\ORM\Query |
||
95 | */ |
||
96 | public function getQuery() |
||
100 | |||
101 | /** |
||
102 | * @return \Doctrine\ORM\QueryBuilder |
||
103 | */ |
||
104 | public function getQb() |
||
108 | |||
109 | /** |
||
110 | * @return array|NULL |
||
111 | */ |
||
112 | public function getFilterMapping() |
||
116 | |||
117 | /** |
||
118 | * @return array|NULL |
||
119 | */ |
||
120 | public function getSortMapping() |
||
124 | |||
125 | /** |
||
126 | * @param Condition $condition |
||
127 | * @param \Doctrine\ORM\QueryBuilder $qb |
||
128 | */ |
||
129 | protected function makeWhere(Condition $condition, \Doctrine\ORM\QueryBuilder $qb = NULL) |
||
166 | |||
167 | /** |
||
168 | * @return string |
||
169 | */ |
||
170 | protected function getRand() |
||
179 | |||
180 | /*********************************** interface IDataSource ************************************/ |
||
181 | |||
182 | /** |
||
183 | * @return int |
||
184 | */ |
||
185 | public function getCount() |
||
192 | |||
193 | /** |
||
194 | * It is possible to use query builder with additional columns. |
||
195 | * In this case, only item at index [0] is returned, because |
||
196 | * it should be an entity object. |
||
197 | * @return array |
||
198 | */ |
||
199 | public function getData() |
||
217 | |||
218 | /** |
||
219 | * Sets filter. |
||
220 | * @param array $conditions |
||
221 | */ |
||
222 | public function filter(array $conditions) |
||
228 | |||
229 | /** |
||
230 | * Sets offset and limit. |
||
231 | * @param int $offset |
||
232 | * @param int $limit |
||
233 | */ |
||
234 | public function limit($offset, $limit) |
||
239 | |||
240 | /** |
||
241 | * Sets sorting. |
||
242 | * @param array $sorting |
||
243 | */ |
||
244 | public function sort(array $sorting) |
||
254 | |||
255 | /** |
||
256 | * @param mixed $column |
||
257 | * @param array $conditions |
||
258 | * @param int $limit |
||
259 | * @return array |
||
260 | * @throws Exception |
||
261 | */ |
||
262 | public function suggest($column, array $conditions, $limit) |
||
297 | } |
||
298 |
Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.
To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.
The function can be called with either null or an array for the parameter
$needle
but will only accept an array as$haystack
.