Completed
Push — master ( c3bbaf...3bd11d )
by Florian
12:33
created
Model/Document.php 1 patch
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,6 +92,7 @@  discard block
 block discarded – undo
92 92
 	 *        	The name of the field
93 93
 	 * @param mixed $value
94 94
 	 *        	The value of this field
95
+	 * @return void
95 96
 	 */
96 97
 	public function addField($fieldname, $value);
97 98
 
@@ -120,6 +121,7 @@  discard block
 block discarded – undo
120 121
 	 *        	The name of the field
121 122
 	 * @param mixed $value
122 123
 	 *        	The additional value of this field
124
+	 * @return void
123 125
 	 */
124 126
 	public function addMultiValueField($field, $value);
125 127
 
@@ -131,6 +133,7 @@  discard block
 block discarded – undo
131 133
 	 *
132 134
 	 * @param string $clazz
133 135
 	 *        	The classname
136
+	 * @return void
134 137
 	 */
135 138
 	public function setEntityClass($clazz);
136 139
 
@@ -150,6 +153,7 @@  discard block
 block discarded – undo
150 153
 	 *
151 154
 	 * @param mixed $id
152 155
 	 *        	The ID of the corresponding entity
156
+	 * @return void
153 157
 	 */
154 158
 	public function setEntityId($id);
155 159
 
@@ -166,6 +170,7 @@  discard block
 block discarded – undo
166 170
 	 * hiding some programatically needed complexity from the user
167 171
 	 *
168 172
 	 * @param string $type        	
173
+	 * @return void
169 174
 	 */
170 175
 	public function setEntityType($type);
171 176
 
@@ -176,7 +181,7 @@  discard block
 block discarded – undo
176 181
 	 *
177 182
 	 * If no entity type is set, the class will be used instead
178 183
 	 *
179
-	 * @param return $type        	
184
+	 * @return string
180 185
 	 */
181 186
 	public function getEntityType();
182 187
 
@@ -186,6 +191,7 @@  discard block
 block discarded – undo
186 191
 	 * <strong>note:</strong> This may not supported by the underlying implementation
187 192
 	 *
188 193
 	 * @param string $path        	
194
+	 * @return void
189 195
 	 */
190 196
 	public function setFile($path);
191 197
 
Please login to merge, or discard this patch.
Tests/application.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 // application.php
3
-require __DIR__ . '/../vendor/autoload.php';
3
+require __DIR__.'/../vendor/autoload.php';
4 4
 
5 5
 use StingerSoft\EntitySearchBundle\Command\ClearIndexCommand;
6 6
 use StingerSoft\EntitySearchBundle\Command\SyncCommand;
Please login to merge, or discard this patch.
Tests/Command/SyncCommandTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@
 block discarded – undo
43 43
 			'get' 
44 44
 		))->disableOriginalConstructor()->getMock();
45 45
 		
46
-		$container->method('get')->willReturnCallback(function ($serviceId) use ($that) {
47
-			switch($serviceId) {
46
+		$container->method('get')->willReturnCallback(function($serviceId) use ($that) {
47
+			switch ($serviceId) {
48 48
 				case 'kernel':
49 49
 					return $that;
50 50
 				case 'doctrine.orm.entity_manager':
Please login to merge, or discard this patch.
Command/SyncCommand.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
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,12 +91,12 @@  discard block
 block discarded – undo
91 91
 			/**
92 92
 			 * @var ClassMetadata $m
93 93
 			 */
94
-			foreach($meta as $m) {
94
+			foreach ($meta as $m) {
95 95
 				
96
-				if($m->getReflectionClass()->isAbstract() || $m->getReflectionClass()->isInterface()) {
96
+				if ($m->getReflectionClass()->isAbstract() || $m->getReflectionClass()->isInterface()) {
97 97
 					continue;
98 98
 				}
99
-				if(!$mapper->isClassIndexable($m->getReflectionClass()->getName())) {
99
+				if (!$mapper->isClassIndexable($m->getReflectionClass()->getName())) {
100 100
 					continue;
101 101
 				}
102 102
 				$this->indexEntity($input, $output, $m->getReflectionClass()->getName());
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		try {
118 118
 			// Get repository for the given entity type
119 119
 			$repository = $entityManager->getRepository($entity);
120
-		} catch(\Exception $e) {
120
+		} catch (\Exception $e) {
121 121
 			$output->writeln(sprintf('<error>No repository found for "%s", check your input</error>', $entity));
122 122
 			return;
123 123
 		}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		$useBatch = !($entityManager->getConnection()->getDatabasePlatform() instanceof SQLServerPlatform);
131 131
 		
132 132
 		$iterableResult = $useBatch ? $queryBuilder->getQuery()->iterate() : $queryBuilder->getQuery()->getResult();
133
-		if($entityCount == 0) {
133
+		if ($entityCount == 0) {
134 134
 			$output->writeln('<comment>No entities found for indexing</comment>');
135 135
 			return;
136 136
 		}
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
 		// Index each entity separate
141 141
 		foreach ($iterableResult as $row) {
142 142
 			$entity = $useBatch ? $row[0] : $row;
143
-			if($this->getEntityToDocumentMapper()->isIndexable($entity)) {
143
+			if ($this->getEntityToDocumentMapper()->isIndexable($entity)) {
144 144
 				$document = $this->getEntityToDocumentMapper()->createDocument($entityManager, $entity);
145
-				if($document === false) continue;
145
+				if ($document === false) continue;
146 146
 				$this->getSearchService($entityManager)->saveDocument($document);
147 147
 				$entitiesIndexed++;
148
-				if($entitiesIndexed % 50 == 0) {
148
+				if ($entitiesIndexed % 50 == 0) {
149 149
 					$entityManager->flush();
150 150
 				}
151 151
 			}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		}
154 154
 		$entityManager->flush();
155 155
 		$entityManager->clear();
156
-		$output->writeln('<comment>Indexed ' . $entitiesIndexed . ' entities</comment>');
156
+		$output->writeln('<comment>Indexed '.$entitiesIndexed.' entities</comment>');
157 157
 	}
158 158
 
159 159
 	/**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 * @return EntityToDocumentMapperInterface
162 162
 	 */
163 163
 	protected function getEntityToDocumentMapper() {
164
-		if(!$this->entityToDocumentMapper) {
164
+		if (!$this->entityToDocumentMapper) {
165 165
 			$this->entityToDocumentMapper = $this->getContainer()->get(EntityToDocumentMapperInterface::SERVICE_ID);
166 166
 		}
167 167
 		return $this->entityToDocumentMapper;
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 * @return SearchService
173 173
 	 */
174 174
 	protected function getSearchService(ObjectManager $manager) {
175
-		if(!$this->searchService) {
175
+		if (!$this->searchService) {
176 176
 			$this->searchService = $this->getContainer()->get(SearchService::SERVICE_ID);
177 177
 		}
178 178
 		$this->searchService->setObjectManager($manager);
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -142,7 +142,9 @@
 block discarded – undo
142 142
 			$entity = $useBatch ? $row[0] : $row;
143 143
 			if($this->getEntityToDocumentMapper()->isIndexable($entity)) {
144 144
 				$document = $this->getEntityToDocumentMapper()->createDocument($entityManager, $entity);
145
-				if($document === false) continue;
145
+				if($document === false) {
146
+					continue;
147
+				}
146 148
 				$this->getSearchService($entityManager)->saveDocument($document);
147 149
 				$entitiesIndexed++;
148 150
 				if($entitiesIndexed % 50 == 0) {
Please login to merge, or discard this patch.