Completed
Push — master ( c30f72...3e93e2 )
by Florian
03:26
created
Command/SyncCommand.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	protected function execute(InputInterface $input, OutputInterface $output) {
67 67
 		// Detect upload path
68
-		if(!self::$defaultUploadPath) {
68
+		if (!self::$defaultUploadPath) {
69 69
 			$root = $this->getContainer()->get('kernel')->getRootDir();
70
-			self::$defaultUploadPath = $root . '/../web/uploads';
70
+			self::$defaultUploadPath = $root.'/../web/uploads';
71 71
 		}
72 72
 		
73 73
 		// Get the entity argument
74 74
 		$entity = $input->getArgument('entity');
75 75
 		
76
-		if($entity == 'all') {
76
+		if ($entity == 'all') {
77 77
 			// $indexHandler = $this->getIndexHandler();
78 78
 			// $entities = $indexHandler->getSearchableEntities();
79 79
 			// foreach($entities as $bundle => $searchableEntities) {
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
 		try {
99 99
 			// Get repository for the given entity type
100 100
 			$repository = $entityManager->getRepository($entity);
101
-		} catch(\Exception $e) {
101
+		} catch (\Exception $e) {
102 102
 			$output->writeln(sprintf('<error>No repository found for "%s", check your input</error>', $entity));
103 103
 			return;
104 104
 		}
105 105
 		
106 106
 		// Get all entities
107 107
 		$entities = $repository->findAll();
108
-		if(count($entities) == 0) {
108
+		if (count($entities) == 0) {
109 109
 			$output->writeln('<comment>No entities found for indexing</comment>');
110 110
 			return;
111 111
 		}
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
 		$entitiesIndexed = 0;
114 114
 		
115 115
 		// Index each entity seperate
116
-		foreach($entities as $entity) {
117
-			if($this->getEntityToDocumentMapper()->isIndexable($entity)){
116
+		foreach ($entities as $entity) {
117
+			if ($this->getEntityToDocumentMapper()->isIndexable($entity)) {
118 118
 				$document = $this->getEntityToDocumentMapper()->createDocument($entityManager, $entity);
119 119
 				$this->getSearchService($entityManager)->saveDocument($document);
120 120
 				$entitiesIndexed++;
121 121
 			}
122 122
 		}
123
-		$output->writeln('<comment>Indexed ' . $entitiesIndexed . ' entities</comment>');
123
+		$output->writeln('<comment>Indexed '.$entitiesIndexed.' entities</comment>');
124 124
 	}
125 125
 
126 126
 	/**
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @return EntityToDocumentMapperInterface
129 129
 	 */
130 130
 	protected function getEntityToDocumentMapper() {
131
-		if(!$this->entityToDocumentMapper) {
131
+		if (!$this->entityToDocumentMapper) {
132 132
 			$this->entityToDocumentMapper = $this->getContainer()->get(EntityToDocumentMapperInterface::SERVICE_ID);
133 133
 		}
134 134
 		return $this->entityToDocumentMapper;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 * @return SearchService
140 140
 	 */
141 141
 	protected function getSearchService(ObjectManager $manager) {
142
-		if(!$this->searchService) {
142
+		if (!$this->searchService) {
143 143
 			$this->searchService = $this->getContainer()->get(SearchService::SERVICE_ID);
144 144
 		}
145 145
 		$this->searchService->setObjectManager($manager);
Please login to merge, or discard this patch.