@@ -17,6 +17,9 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class StingerSoftEntitySearchBundle extends Bundle { |
| 19 | 19 | |
| 20 | + /** |
|
| 21 | + * @param string $env |
|
| 22 | + */ |
|
| 20 | 23 | public static function getRequiredBundles($env) { |
| 21 | 24 | $bundles = array(); |
| 22 | 25 | $bundles['StingerSoftEntitySearchBundle'] = '\StingerSoft\EntitySearchBundle\StingerSoftEntitySearchBundle'; |
@@ -89,12 +89,14 @@ |
||
| 89 | 89 | * @return boolean|Document Returns false if no document could be created |
| 90 | 90 | */ |
| 91 | 91 | public function createDocument(ObjectManager $manager, $object) { |
| 92 | - if(!$this->isIndexable($object)) |
|
| 93 | - return false; |
|
| 92 | + if(!$this->isIndexable($object)) { |
|
| 93 | + return false; |
|
| 94 | + } |
|
| 94 | 95 | $document = $this->getSearchService($manager)->createEmptyDocumentFromEntity($object); |
| 95 | 96 | $index = $this->fillDocument($document, $object); |
| 96 | - if($index == false) |
|
| 97 | - return false; |
|
| 97 | + if($index == false) { |
|
| 98 | + return false; |
|
| 99 | + } |
|
| 98 | 100 | |
| 99 | 101 | return $document; |
| 100 | 102 | } |
@@ -25,7 +25,6 @@ |
||
| 25 | 25 | * Tries to create a document from the given object |
| 26 | 26 | * |
| 27 | 27 | * @param ObjectManager $manager |
| 28 | - * @param object $object |
|
| 29 | 28 | * @return boolean|Document Returns false if no document could be created |
| 30 | 29 | */ |
| 31 | 30 | public function getEntity(ObjectManager $manager, Document $document); |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | * |
| 105 | 105 | * @param string $name |
| 106 | 106 | * Name of the property to set |
| 107 | - * @param mixed $value |
|
| 107 | + * @param string[] $value |
|
| 108 | 108 | * The value of the property |
| 109 | 109 | */ |
| 110 | 110 | public function __set($name, $value) { |
@@ -73,7 +73,9 @@ discard block |
||
| 73 | 73 | * @param LifecycleEventArgs $args |
| 74 | 74 | */ |
| 75 | 75 | public function postPersist(LifecycleEventArgs $args) { |
| 76 | - if(!$this->enableIndexing) return; |
|
| 76 | + if(!$this->enableIndexing) { |
|
| 77 | + return; |
|
| 78 | + } |
|
| 77 | 79 | $this->updateEntity($args->getObject(), $args->getObjectManager()); |
| 78 | 80 | } |
| 79 | 81 | |
@@ -90,7 +92,9 @@ discard block |
||
| 90 | 92 | * @param LifecycleEventArgs $args |
| 91 | 93 | */ |
| 92 | 94 | public function preRemove(LifecycleEventArgs $args) { |
| 93 | - if(!$this->enableIndexing) return; |
|
| 95 | + if(!$this->enableIndexing) { |
|
| 96 | + return; |
|
| 97 | + } |
|
| 94 | 98 | $this->removeEntity($args->getObject(), $args->getObjectManager()); |
| 95 | 99 | } |
| 96 | 100 | |
@@ -100,7 +104,9 @@ discard block |
||
| 100 | 104 | * @param LifecycleEventArgs $args |
| 101 | 105 | */ |
| 102 | 106 | public function postUpdate(LifecycleEventArgs $args) { |
| 103 | - if(!$this->enableIndexing) return; |
|
| 107 | + if(!$this->enableIndexing) { |
|
| 108 | + return; |
|
| 109 | + } |
|
| 104 | 110 | $this->updateEntity($args->getObject(), $args->getObjectManager()); |
| 105 | 111 | } |
| 106 | 112 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | 102 | * |
| 103 | - * @param FormBuilderInterface|Form $builder |
|
| 103 | + * @param FormInterface $builder |
|
| 104 | 104 | * @param FacetSet $facets |
| 105 | 105 | */ |
| 106 | 106 | protected function createFacets($builder, FacetSet $facets, array $options, $data) { |
@@ -143,6 +143,9 @@ discard block |
||
| 143 | 143 | return $choices; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | + /** |
|
| 147 | + * @param string $facetType |
|
| 148 | + */ |
|
| 146 | 149 | protected function formatFacet($formatter, $facetType, $facet, $count) { |
| 147 | 150 | $default = $facet . ' (' . $count . ')'; |
| 148 | 151 | if(!$formatter) { |
@@ -134,12 +134,15 @@ |
||
| 134 | 134 | protected function generateFacetChoices($facetType, array $facets, array $selectedFacets = array(), $formatter) { |
| 135 | 135 | $choices = array(); |
| 136 | 136 | foreach($facets as $facet => $count) { |
| 137 | - if($count == 0 && !in_array($facet, $selectedFacets)) |
|
| 138 | - continue; |
|
| 137 | + if($count == 0 && !in_array($facet, $selectedFacets)) { |
|
| 138 | + continue; |
|
| 139 | + } |
|
| 139 | 140 | $choices[$this->formatFacet($formatter, $facetType, $facet, $count)] = $facet; |
| 140 | 141 | } |
| 141 | 142 | foreach($selectedFacets as $facet) { |
| 142 | - if(isset($facets[$facet])) continue; |
|
| 143 | + if(isset($facets[$facet])) { |
|
| 144 | + continue; |
|
| 145 | + } |
|
| 143 | 146 | $count = 0; |
| 144 | 147 | $choices[$this->formatFacet($formatter, $facetType, $facet, $count)] = $facet; |
| 145 | 148 | } |
@@ -31,8 +31,9 @@ |
||
| 31 | 31 | * @see \StingerSoft\EntitySearchBundle\Services\SearchService::setObjectManager() |
| 32 | 32 | */ |
| 33 | 33 | public function setObjectManager(ObjectManager $om) { |
| 34 | - if($this->objectManager) |
|
| 35 | - return; |
|
| 34 | + if($this->objectManager) { |
|
| 35 | + return; |
|
| 36 | + } |
|
| 36 | 37 | $this->objectManager = $om; |
| 37 | 38 | } |
| 38 | 39 | |