1 | <?php |
||
23 | class Indexer |
||
24 | { |
||
25 | const TEXT_ALL_DATA_FIELD = 'all_text'; |
||
26 | |||
27 | const RELATION_ONE_TO_ONE = 'one-to-one'; |
||
28 | const RELATION_MANY_TO_MANY = 'many-to-many'; |
||
29 | const RELATION_MANY_TO_ONE = 'many-to-one'; |
||
30 | const RELATION_ONE_TO_MANY = 'one-to-many'; |
||
31 | |||
32 | const SEARCH_ENTITY_PERMISSION = 'VIEW'; |
||
33 | |||
34 | /** @var EngineInterface */ |
||
35 | protected $engine; |
||
36 | |||
37 | /** @var ObjectManager */ |
||
38 | protected $em; |
||
39 | |||
40 | /** @var ObjectMapper */ |
||
41 | protected $mapper; |
||
42 | |||
43 | /** @var SecurityProvider */ |
||
44 | protected $securityProvider; |
||
45 | |||
46 | /** @var AclHelper */ |
||
47 | protected $searchAclHelper; |
||
48 | |||
49 | /** @var bool */ |
||
50 | protected $isAllowedApplyAcl = true; |
||
51 | |||
52 | /** |
||
53 | * @param ObjectManager $em |
||
54 | * @param EngineInterface $engine |
||
55 | * @param ObjectMapper $mapper |
||
56 | * @param SecurityProvider $securityProvider |
||
57 | * @param AclHelper $searchAclHelper |
||
58 | * @param EventDispatcherInterface $dispatcher |
||
59 | */ |
||
60 | public function __construct( |
||
75 | |||
76 | /** |
||
77 | * Get array with mapped entities |
||
78 | * |
||
79 | * @return array |
||
80 | */ |
||
81 | public function getEntitiesListAliases() |
||
85 | |||
86 | /** |
||
87 | * Gets search aliases for entities |
||
88 | * |
||
89 | * @param string[] $classNames The list of entity FQCN |
||
90 | * |
||
91 | * @return array [entity class name => entity search alias, ...] |
||
92 | * |
||
93 | * @throws \InvalidArgumentException if some of requested entities is not registered in the search index |
||
94 | * or has no the search alias |
||
95 | */ |
||
96 | public function getEntityAliases(array $classNames = []) |
||
100 | |||
101 | /** |
||
102 | * Gets the search alias of a given entity |
||
103 | * |
||
104 | * @param string $className The FQCN of an entity |
||
105 | * |
||
106 | * @return string|null The search alias of the entity |
||
107 | * or NULL if the entity is not registered in a search index or has no the search alias |
||
108 | */ |
||
109 | public function getEntityAlias($className) |
||
113 | |||
114 | /** |
||
115 | * Get list of entities allowed to user |
||
116 | * |
||
117 | * @return array |
||
118 | */ |
||
119 | public function getAllowedEntitiesListAliases() |
||
123 | |||
124 | /** |
||
125 | * @param string $searchString |
||
126 | * @param integer $offset |
||
127 | * @param integer $maxResults |
||
128 | * @param string $from |
||
129 | * @param integer $page |
||
130 | * |
||
131 | * @return Query |
||
132 | */ |
||
133 | public function getSimpleSearchQuery($searchString, $offset = 0, $maxResults = 0, $from = null, $page = 0) |
||
162 | |||
163 | /** |
||
164 | * @param string $searchString |
||
165 | * @param integer $offset |
||
166 | * @param integer $maxResults |
||
167 | * @param string $from |
||
168 | * @param integer $page |
||
169 | * @return Result |
||
170 | */ |
||
171 | public function simpleSearch($searchString, $offset = 0, $maxResults = 0, $from = null, $page = 0) |
||
177 | |||
178 | /** |
||
179 | * Get query builder with select instance |
||
180 | * |
||
181 | * @return Query |
||
182 | */ |
||
183 | public function select() |
||
192 | |||
193 | /** |
||
194 | * Run query with query builder |
||
195 | * |
||
196 | * @param Query $query |
||
197 | * @return Result |
||
198 | */ |
||
199 | public function query(Query $query) |
||
209 | |||
210 | /** |
||
211 | * Advanced search from API |
||
212 | * |
||
213 | * @param string $expression |
||
214 | * @return Result |
||
215 | */ |
||
216 | public function advancedSearch($expression) |
||
231 | |||
232 | /** |
||
233 | * @param bool $value |
||
234 | */ |
||
235 | public function setIsAllowedApplyAcl($value) |
||
239 | |||
240 | /** |
||
241 | * Do query manipulations such as ACL apply etc. |
||
242 | * |
||
243 | * @param Query $query |
||
244 | */ |
||
245 | protected function prepareQuery(Query $query) |
||
252 | |||
253 | /** |
||
254 | * Apply special behavior of class inheritance processing |
||
255 | * |
||
256 | * @param Query $query |
||
257 | */ |
||
258 | protected function applyModesBehavior(Query $query) |
||
302 | |||
303 | /** |
||
304 | * Filter array of entities. Return array of allowed entities |
||
305 | * |
||
306 | * @param string $attribute Permission |
||
307 | * @param string[] $entities The list of entity class names to be checked |
||
308 | * @return string[] |
||
309 | */ |
||
310 | protected function filterAllowedEntities($attribute, $entities) |
||
324 | } |
||
325 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: