Ejemplo n.º 1
0
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $this->manager = $this->getSearchManager();
     $this->type = $this->manager->getType($input->getOption('type'));
     $this->batchSize = $input->getOption('batch');
     $this->repository = $this->getRepository($input->getOption('repository'));
 }
 private function createSearchRequest(Request $request) : SearchRequestInterface
 {
     $type = $this->manager->getType($request->get('type'));
     $phrase = $request->query->has('phrase') ? $request->query->get('phrase') : '';
     $fields = new ArrayCollection();
     $type->getFields()->map(function (FieldInterface $field) use($fields, $request) {
         if ($request->query->has($field->getName())) {
             $field->setValue($request->query->get($field->getName(), ''));
             $fields->set($field->getName(), $field);
         }
     });
     return new SearchRequest($type, $fields, $phrase, $request->getLocale());
 }