@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | private $searchService; |
| 56 | 56 | |
| 57 | 57 | public function searchAction(Request $request) { |
| 58 | - if($request->query->get('term', false) !== false) { |
|
| 58 | + if ($request->query->get('term', false) !== false) { |
|
| 59 | 59 | $this->setSearchTerm($request->getSession(), $request->query->get('term')); |
| 60 | 60 | return $this->redirectToRoute('stinger_soft_entity_search_search'); |
| 61 | 61 | } |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | )); |
| 71 | 71 | |
| 72 | 72 | $facetForm->handleRequest($request); |
| 73 | - if($facetForm->isSubmitted()) { |
|
| 74 | - if($facetForm->get('clear')->isClicked()) { |
|
| 73 | + if ($facetForm->isSubmitted()) { |
|
| 74 | + if ($facetForm->get('clear')->isClicked()) { |
|
| 75 | 75 | $query->setFacets($this->getDefaultFacets()); |
| 76 | 76 | } |
| 77 | 77 | $this->setSearchTerm($request->getSession(), $query->getSearchTerm()); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | $page = $request->query->get('page', 1); |
| 89 | 89 | $results = array(); |
| 90 | - if($result instanceof PaginatableResultSet) { |
|
| 90 | + if ($result instanceof PaginatableResultSet) { |
|
| 91 | 91 | $results = $result->paginate($page, self::RESULTS_PER_PAGE); |
| 92 | 92 | } else { |
| 93 | 93 | $results = $result->getResults(($page - 1) * self::RESULTS_PER_PAGE, self::RESULTS_PER_PAGE); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @return string[string][] |
| 137 | 137 | */ |
| 138 | 138 | protected function getSearchFacets(SessionInterface $session) { |
| 139 | - $facets = $session()->get(self::SESSION_PREFIX . '_facets', false); |
|
| 139 | + $facets = $session()->get(self::SESSION_PREFIX.'_facets', false); |
|
| 140 | 140 | return $facets ? json_decode($facets, true) : $this->getDefaultFacets(); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param string[string][] $facets |
| 148 | 148 | */ |
| 149 | 149 | protected function setSearchFacets(SessionInterface $session, $facets) { |
| 150 | - $session->set(self::SESSION_PREFIX . '_facets', json_encode($facets)); |
|
| 150 | + $session->set(self::SESSION_PREFIX.'_facets', json_encode($facets)); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @return mixed |
| 158 | 158 | */ |
| 159 | 159 | protected function getSearchTerm(SessionInterface $session) { |
| 160 | - return $session->get(self::SESSION_PREFIX . '_term', false); |
|
| 160 | + return $session->get(self::SESSION_PREFIX.'_term', false); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @param string $term |
| 168 | 168 | */ |
| 169 | 169 | protected function setSearchTerm(SessionInterface $session, $term) { |
| 170 | - $session->set(self::SESSION_PREFIX . '_term', $term); |
|
| 170 | + $session->set(self::SESSION_PREFIX.'_term', $term); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -67,15 +67,15 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | protected function execute(InputInterface $input, OutputInterface $output) { |
| 69 | 69 | // Detect upload path |
| 70 | - if(!self::$defaultUploadPath) { |
|
| 70 | + if (!self::$defaultUploadPath) { |
|
| 71 | 71 | $root = $this->getContainer()->get('kernel')->getRootDir(); |
| 72 | - self::$defaultUploadPath = $root . '/../web/uploads'; |
|
| 72 | + self::$defaultUploadPath = $root.'/../web/uploads'; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // Get the entity argument |
| 76 | 76 | $entity = $input->getArgument('entity'); |
| 77 | 77 | |
| 78 | - if($entity == 'all') { |
|
| 78 | + if ($entity == 'all') { |
|
| 79 | 79 | /** |
| 80 | 80 | * @var EntityManager $entityManager |
| 81 | 81 | */ |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | /** |
| 92 | 92 | * @var ClassMetadata $m |
| 93 | 93 | */ |
| 94 | - foreach($meta as $m) { |
|
| 95 | - if($m->getReflectionClass()->isAbstract() || $m->getReflectionClass()->isInterface()) { |
|
| 94 | + foreach ($meta as $m) { |
|
| 95 | + if ($m->getReflectionClass()->isAbstract() || $m->getReflectionClass()->isInterface()) { |
|
| 96 | 96 | continue; |
| 97 | 97 | } |
| 98 | - if(!$mapper->isClassIndexable($m->getReflectionClass()->getName())) { |
|
| 98 | + if (!$mapper->isClassIndexable($m->getReflectionClass()->getName())) { |
|
| 99 | 99 | continue; |
| 100 | 100 | } |
| 101 | 101 | $this->indexEntity($input, $output, $m->getReflectionClass()->getName()); |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | try { |
| 116 | 116 | // Get repository for the given entity type |
| 117 | 117 | $repository = $entityManager->getRepository($entity); |
| 118 | - } catch(\Exception $e) { |
|
| 118 | + } catch (\Exception $e) { |
|
| 119 | 119 | $output->writeln(sprintf('<error>No repository found for "%s", check your input</error>', $entity)); |
| 120 | 120 | return; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // Get all entities |
| 124 | 124 | $entities = $repository->findAll(); |
| 125 | - if(count($entities) == 0) { |
|
| 125 | + if (count($entities) == 0) { |
|
| 126 | 126 | $output->writeln('<comment>No entities found for indexing</comment>'); |
| 127 | 127 | return; |
| 128 | 128 | } |
@@ -130,14 +130,14 @@ discard block |
||
| 130 | 130 | $entitiesIndexed = 0; |
| 131 | 131 | |
| 132 | 132 | // Index each entity seperate |
| 133 | - foreach($entities as $entity) { |
|
| 134 | - if($this->getEntityToDocumentMapper()->isIndexable($entity)) { |
|
| 133 | + foreach ($entities as $entity) { |
|
| 134 | + if ($this->getEntityToDocumentMapper()->isIndexable($entity)) { |
|
| 135 | 135 | $document = $this->getEntityToDocumentMapper()->createDocument($entityManager, $entity); |
| 136 | 136 | $this->getSearchService($entityManager)->saveDocument($document); |
| 137 | 137 | $entitiesIndexed++; |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | - $output->writeln('<comment>Indexed ' . $entitiesIndexed . ' entities</comment>'); |
|
| 140 | + $output->writeln('<comment>Indexed '.$entitiesIndexed.' entities</comment>'); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @return EntityToDocumentMapperInterface |
| 146 | 146 | */ |
| 147 | 147 | protected function getEntityToDocumentMapper() { |
| 148 | - if(!$this->entityToDocumentMapper) { |
|
| 148 | + if (!$this->entityToDocumentMapper) { |
|
| 149 | 149 | $this->entityToDocumentMapper = $this->getContainer()->get(EntityToDocumentMapperInterface::SERVICE_ID); |
| 150 | 150 | } |
| 151 | 151 | return $this->entityToDocumentMapper; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @return SearchService |
| 157 | 157 | */ |
| 158 | 158 | protected function getSearchService(ObjectManager $manager) { |
| 159 | - if(!$this->searchService) { |
|
| 159 | + if (!$this->searchService) { |
|
| 160 | 160 | $this->searchService = $this->getContainer()->get(SearchService::SERVICE_ID); |
| 161 | 161 | } |
| 162 | 162 | $this->searchService->setObjectManager($manager); |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | $builder->resetModelTransformers(); |
| 32 | 32 | $builder->resetViewTransformers(); |
| 33 | 33 | |
| 34 | - if($options['multiple']) { |
|
| 35 | - $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) { |
|
| 34 | + if ($options['multiple']) { |
|
| 35 | + $builder->addEventListener(FormEvents::PRE_SUBMIT, function(FormEvent $event) { |
|
| 36 | 36 | $event->stopPropagation(); |
| 37 | 37 | }, 1); |
| 38 | 38 | } |
| 39 | - $builder->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) { |
|
| 39 | + $builder->addEventListener(FormEvents::SUBMIT, function(FormEvent $event) { |
|
| 40 | 40 | $data = $event->getForm()->getExtraData(); |
| 41 | 41 | //$event->setData(array_unique(array_merge($data, $event->getData()))); |
| 42 | 42 | $event->setData($data); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | public function configureOptions(OptionsResolver $resolver) { |
| 63 | 63 | $resolver->setDefault('translation_domain', 'StingerSoftEntitySearchBundle'); |
| 64 | 64 | $resolver->setDefault('by_reference', true); |
| 65 | - if(Kernel::VERSION_ID < 30000) { |
|
| 65 | + if (Kernel::VERSION_ID < 30000) { |
|
| 66 | 66 | $resolver->setDefault('choices_as_values', true); |
| 67 | 67 | } |
| 68 | 68 | } |