@@ -92,7 +92,7 @@ |
||
| 92 | 92 | |
| 93 | 93 | $results = []; |
| 94 | 94 | |
| 95 | - foreach($entities as $entity) { |
|
| 95 | + foreach ($entities as $entity) { |
|
| 96 | 96 | //If the entity is newly created (ID null), add it as result and persist it. |
| 97 | 97 | if ($entity->getID() === null) { |
| 98 | 98 | $this->entityManager->persist($entity); |
@@ -126,15 +126,15 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $this->assertSame('Node 1', $nodes[0]->getName()); |
| 128 | 128 | //Node must be from DB |
| 129 | - $this->assertNotNull( $nodes[0]->getID()); |
|
| 129 | + $this->assertNotNull($nodes[0]->getID()); |
|
| 130 | 130 | |
| 131 | 131 | $this->assertSame('Node 1.1', $nodes[1]->getName()); |
| 132 | 132 | //Node must be from DB |
| 133 | - $this->assertNotNull( $nodes[1]->getID()); |
|
| 133 | + $this->assertNotNull($nodes[1]->getID()); |
|
| 134 | 134 | |
| 135 | 135 | $this->assertSame('Node 1.1.1', $nodes[2]->getName()); |
| 136 | 136 | //Node must be from DB |
| 137 | - $this->assertNotNull( $nodes[2]->getID()); |
|
| 137 | + $this->assertNotNull($nodes[2]->getID()); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | public function testGetNewEntityNew(): void |
@@ -145,15 +145,15 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $this->assertSame('Element 1', $nodes[0]->getName()); |
| 147 | 147 | //Node must not be from DB |
| 148 | - $this->assertNull( $nodes[0]->getID()); |
|
| 148 | + $this->assertNull($nodes[0]->getID()); |
|
| 149 | 149 | |
| 150 | 150 | $this->assertSame('Element 1.1', $nodes[1]->getName()); |
| 151 | 151 | //Node must not be from DB |
| 152 | - $this->assertNull( $nodes[1]->getID()); |
|
| 152 | + $this->assertNull($nodes[1]->getID()); |
|
| 153 | 153 | |
| 154 | 154 | $this->assertSame('Element 1.1.1', $nodes[2]->getName()); |
| 155 | 155 | //Node must not be from DB |
| 156 | - $this->assertNull( $nodes[2]->getID()); |
|
| 156 | + $this->assertNull($nodes[2]->getID()); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | public function testGetNewEntityMixed(): void |
@@ -164,14 +164,14 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | $this->assertSame('Node 1', $nodes[0]->getName()); |
| 166 | 166 | //Node must be from DB |
| 167 | - $this->assertNotNull( $nodes[0]->getID()); |
|
| 167 | + $this->assertNotNull($nodes[0]->getID()); |
|
| 168 | 168 | |
| 169 | 169 | $this->assertSame('Node 1.1', $nodes[1]->getName()); |
| 170 | 170 | //Node must be from DB |
| 171 | - $this->assertNotNull( $nodes[1]->getID()); |
|
| 171 | + $this->assertNotNull($nodes[1]->getID()); |
|
| 172 | 172 | |
| 173 | 173 | $this->assertSame('New Node', $nodes[2]->getName()); |
| 174 | 174 | //Node must not be from DB |
| 175 | - $this->assertNull( $nodes[2]->getID()); |
|
| 175 | + $this->assertNull($nodes[2]->getID()); |
|
| 176 | 176 | } |
| 177 | 177 | } |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | ->add('reset', ResetType::class, ['label' => 'reset']); |
| 132 | 132 | |
| 133 | 133 | //Add the remove_avatar button if the user has an avatar (we have to add this dynamically) |
| 134 | - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (PreSetDataEvent $event) { |
|
| 134 | + $builder->addEventListener(FormEvents::PRE_SET_DATA, function(PreSetDataEvent $event) { |
|
| 135 | 135 | $data = $event->getData(); |
| 136 | 136 | if (!$data instanceof User) { |
| 137 | 137 | return; |
@@ -43,12 +43,12 @@ |
||
| 43 | 43 | |
| 44 | 44 | $resolver->setDefaults([ |
| 45 | 45 | 'class' => PartLot::class, |
| 46 | - 'choice_label' => ChoiceList::label($this, function (PartLot $part_lot) { |
|
| 46 | + 'choice_label' => ChoiceList::label($this, function(PartLot $part_lot) { |
|
| 47 | 47 | return ($part_lot->getStorageLocation() ? $part_lot->getStorageLocation()->getFullPath() : '') |
| 48 | - . ' (' . $part_lot->getName() . '): ' . $part_lot->getAmount(); |
|
| 48 | + . ' ('.$part_lot->getName().'): '.$part_lot->getAmount(); |
|
| 49 | 49 | }), |
| 50 | - 'query_builder' => function (Options $options) { |
|
| 51 | - return function (EntityRepository $er) use ($options) { |
|
| 50 | + 'query_builder' => function(Options $options) { |
|
| 51 | + return function(EntityRepository $er) use ($options) { |
|
| 52 | 52 | return $er->createQueryBuilder('l') |
| 53 | 53 | ->where('l.part = :part') |
| 54 | 54 | ->setParameter('part', $options['part']); |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | { |
| 44 | 44 | $resolver->setDefaults([ |
| 45 | 45 | 'choices' => $this->available_themes, |
| 46 | - 'choice_label' => static function ($entity, $key, $value) { |
|
| 46 | + 'choice_label' => static function($entity, $key, $value) { |
|
| 47 | 47 | return $value; |
| 48 | 48 | }, |
| 49 | 49 | 'choice_translation_domain' => false, |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | $resolver->setDefaults([ |
| 43 | 43 | 'filter' => 'picture', |
| 44 | 44 | 'choice_translation_domain' => false, |
| 45 | - 'choice_attr' => static function (Options $options) { |
|
| 46 | - return static function ($choice, $key, $value) use ($options) { |
|
| 45 | + 'choice_attr' => static function(Options $options) { |
|
| 46 | + return static function($choice, $key, $value) use ($options) { |
|
| 47 | 47 | /** @var Attachment $choice */ |
| 48 | 48 | $tmp = ['data-subtext' => $choice->getFilename() ?? 'URL']; |
| 49 | 49 | |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | }; |
| 58 | 58 | }, |
| 59 | 59 | 'choice_label' => 'name', |
| 60 | - 'choice_loader' => static function (Options $options) { |
|
| 60 | + 'choice_loader' => static function(Options $options) { |
|
| 61 | 61 | return new CallbackChoiceLoader( |
| 62 | - static function () use ($options) { |
|
| 62 | + static function() use ($options) { |
|
| 63 | 63 | $entity = $options['entity']; |
| 64 | 64 | if (!$entity instanceof AttachmentContainingDBElement) { |
| 65 | 65 | throw new RuntimeException('$entity must have Attachments! (be of type AttachmentContainingDBElement)'); |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | $formRequest = clone $request; |
| 130 | 130 | $formRequest->setMethod('GET'); |
| 131 | 131 | $filter = new PartFilter($this->nodesListBuilder); |
| 132 | - if($filter_changer !== null){ |
|
| 132 | + if ($filter_changer !== null) { |
|
| 133 | 133 | $filter_changer($filter); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $filterForm = $this->createForm(PartFilterType::class, $filter, ['method' => 'GET']); |
| 137 | - if($form_changer !== null) { |
|
| 137 | + if ($form_changer !== null) { |
|
| 138 | 138 | $form_changer($filterForm); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | return $this->showListWithFilter($request, |
| 166 | 166 | 'parts/lists/category_list.html.twig', |
| 167 | - function (PartFilter $filter) use ($category) { |
|
| 167 | + function(PartFilter $filter) use ($category) { |
|
| 168 | 168 | $filter->getCategory()->setOperator('INCLUDING_CHILDREN')->setValue($category); |
| 169 | - }, function (FormInterface $filterForm) { |
|
| 169 | + }, function(FormInterface $filterForm) { |
|
| 170 | 170 | $this->disableFormFieldAfterCreation($filterForm->get('category')->get('value')); |
| 171 | 171 | }, [ |
| 172 | 172 | 'entity' => $category, |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | return $this->showListWithFilter($request, |
| 188 | 188 | 'parts/lists/footprint_list.html.twig', |
| 189 | - function (PartFilter $filter) use ($footprint) { |
|
| 189 | + function(PartFilter $filter) use ($footprint) { |
|
| 190 | 190 | $filter->getFootprint()->setOperator('INCLUDING_CHILDREN')->setValue($footprint); |
| 191 | - }, function (FormInterface $filterForm) { |
|
| 191 | + }, function(FormInterface $filterForm) { |
|
| 192 | 192 | $this->disableFormFieldAfterCreation($filterForm->get('footprint')->get('value')); |
| 193 | 193 | }, [ |
| 194 | 194 | 'entity' => $footprint, |
@@ -208,9 +208,9 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | return $this->showListWithFilter($request, |
| 210 | 210 | 'parts/lists/manufacturer_list.html.twig', |
| 211 | - function (PartFilter $filter) use ($manufacturer) { |
|
| 211 | + function(PartFilter $filter) use ($manufacturer) { |
|
| 212 | 212 | $filter->getManufacturer()->setOperator('INCLUDING_CHILDREN')->setValue($manufacturer); |
| 213 | - }, function (FormInterface $filterForm) { |
|
| 213 | + }, function(FormInterface $filterForm) { |
|
| 214 | 214 | $this->disableFormFieldAfterCreation($filterForm->get('manufacturer')->get('value')); |
| 215 | 215 | }, [ |
| 216 | 216 | 'entity' => $manufacturer, |
@@ -230,9 +230,9 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | return $this->showListWithFilter($request, |
| 232 | 232 | 'parts/lists/store_location_list.html.twig', |
| 233 | - function (PartFilter $filter) use ($storelocation) { |
|
| 233 | + function(PartFilter $filter) use ($storelocation) { |
|
| 234 | 234 | $filter->getStorelocation()->setOperator('INCLUDING_CHILDREN')->setValue($storelocation); |
| 235 | - }, function (FormInterface $filterForm) { |
|
| 235 | + }, function(FormInterface $filterForm) { |
|
| 236 | 236 | $this->disableFormFieldAfterCreation($filterForm->get('storelocation')->get('value')); |
| 237 | 237 | }, [ |
| 238 | 238 | 'entity' => $storelocation, |
@@ -252,9 +252,9 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | return $this->showListWithFilter($request, |
| 254 | 254 | 'parts/lists/supplier_list.html.twig', |
| 255 | - function (PartFilter $filter) use ($supplier) { |
|
| 255 | + function(PartFilter $filter) use ($supplier) { |
|
| 256 | 256 | $filter->getSupplier()->setOperator('INCLUDING_CHILDREN')->setValue($supplier); |
| 257 | - }, function (FormInterface $filterForm) { |
|
| 257 | + }, function(FormInterface $filterForm) { |
|
| 258 | 258 | $this->disableFormFieldAfterCreation($filterForm->get('supplier')->get('value')); |
| 259 | 259 | }, [ |
| 260 | 260 | 'entity' => $supplier, |
@@ -274,9 +274,9 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | return $this->showListWithFilter($request, |
| 276 | 276 | 'parts/lists/tags_list.html.twig', |
| 277 | - function (PartFilter $filter) use ($tag) { |
|
| 277 | + function(PartFilter $filter) use ($tag) { |
|
| 278 | 278 | $filter->getTags()->setOperator('ANY')->setValue($tag); |
| 279 | - }, function (FormInterface $filterForm) { |
|
| 279 | + }, function(FormInterface $filterForm) { |
|
| 280 | 280 | $this->disableFormFieldAfterCreation($filterForm->get('tags')->get('value')); |
| 281 | 281 | }, [ |
| 282 | 282 | 'tag' => $tag, |
@@ -334,6 +334,6 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | public function showAll(Request $request, DataTableFactory $dataTable) |
| 336 | 336 | { |
| 337 | - return $this->showListWithFilter($request,'parts/lists/all_list.html.twig'); |
|
| 337 | + return $this->showListWithFilter($request, 'parts/lists/all_list.html.twig'); |
|
| 338 | 338 | } |
| 339 | 339 | } |
@@ -168,13 +168,13 @@ discard block |
||
| 168 | 168 | ) ? $connection->getConfiguration()->getSchemaAssetsFilter() : null; |
| 169 | 169 | |
| 170 | 170 | //Disable foreign key checks |
| 171 | - if($platform instanceof AbstractMySQLPlatform) { |
|
| 171 | + if ($platform instanceof AbstractMySQLPlatform) { |
|
| 172 | 172 | $connection->executeQuery('SET foreign_key_checks = 0;'); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | foreach ($orderedTables as $tbl) { |
| 176 | 176 | // If we have a filter expression, check it and skip if necessary |
| 177 | - if (! $emptyFilterExpression && ! preg_match($filterExpr, $tbl)) { |
|
| 177 | + if (!$emptyFilterExpression && !preg_match($filterExpr, $tbl)) { |
|
| 178 | 178 | continue; |
| 179 | 179 | } |
| 180 | 180 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | // Support schema asset filters as presented in |
| 187 | - if (is_callable($schemaAssetsFilter) && ! $schemaAssetsFilter($tbl)) { |
|
| 187 | + if (is_callable($schemaAssetsFilter) && !$schemaAssetsFilter($tbl)) { |
|
| 188 | 188 | continue; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | //Reenable foreign key checks |
| 205 | - if($platform instanceof AbstractMySQLPlatform) { |
|
| 205 | + if ($platform instanceof AbstractMySQLPlatform) { |
|
| 206 | 206 | $connection->executeQuery('SET foreign_key_checks = 1;'); |
| 207 | 207 | } |
| 208 | 208 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | { |
| 212 | 212 | $tableIdentifier = new Identifier($tableName); |
| 213 | 213 | |
| 214 | - return 'ALTER TABLE '. $tableIdentifier->getQuotedName($platform) .' AUTO_INCREMENT = 1;'; |
|
| 214 | + return 'ALTER TABLE '.$tableIdentifier->getQuotedName($platform).' AUTO_INCREMENT = 1;'; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $sorter = new TopologicalSorter(); |
| 225 | 225 | |
| 226 | 226 | foreach ($classes as $class) { |
| 227 | - if (! $sorter->hasNode($class->name)) { |
|
| 227 | + if (!$sorter->hasNode($class->name)) { |
|
| 228 | 228 | $sorter->addNode($class->name, $class); |
| 229 | 229 | } |
| 230 | 230 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $parentClass = $em->getClassMetadata($parentClass); |
| 234 | 234 | $parentClassName = $parentClass->getName(); |
| 235 | 235 | |
| 236 | - if (! $sorter->hasNode($parentClassName)) { |
|
| 236 | + if (!$sorter->hasNode($parentClassName)) { |
|
| 237 | 237 | $sorter->addNode($parentClassName, $parentClass); |
| 238 | 238 | } |
| 239 | 239 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | foreach ($class->associationMappings as $assoc) { |
| 244 | - if (! $assoc['isOwningSide']) { |
|
| 244 | + if (!$assoc['isOwningSide']) { |
|
| 245 | 245 | continue; |
| 246 | 246 | } |
| 247 | 247 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | assert($targetClass instanceof ClassMetadata); |
| 250 | 250 | $targetClassName = $targetClass->getName(); |
| 251 | 251 | |
| 252 | - if (! $sorter->hasNode($targetClassName)) { |
|
| 252 | + if (!$sorter->hasNode($targetClassName)) { |
|
| 253 | 253 | $sorter->addNode($targetClassName, $targetClass); |
| 254 | 254 | } |
| 255 | 255 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $parentClass = $em->getClassMetadata($parentClass); |
| 262 | 262 | $parentClassName = $parentClass->getName(); |
| 263 | 263 | |
| 264 | - if (! $sorter->hasNode($parentClassName)) { |
|
| 264 | + if (!$sorter->hasNode($parentClassName)) { |
|
| 265 | 265 | $sorter->addNode($parentClassName, $parentClass); |
| 266 | 266 | } |
| 267 | 267 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | foreach ($classes as $class) { |
| 286 | 286 | foreach ($class->associationMappings as $assoc) { |
| 287 | - if (! $assoc['isOwningSide'] || $assoc['type'] !== ClassMetadataInfo::MANY_TO_MANY) { |
|
| 287 | + if (!$assoc['isOwningSide'] || $assoc['type'] !== ClassMetadataInfo::MANY_TO_MANY) { |
|
| 288 | 288 | continue; |
| 289 | 289 | } |
| 290 | 290 | |
@@ -297,8 +297,8 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | private function getTableName(ClassMetadata $class, AbstractPlatform $platform): string |
| 299 | 299 | { |
| 300 | - if (isset($class->table['schema']) && ! method_exists($class, 'getSchemaName')) { |
|
| 301 | - return $class->table['schema'] . '.' . |
|
| 300 | + if (isset($class->table['schema']) && !method_exists($class, 'getSchemaName')) { |
|
| 301 | + return $class->table['schema'].'.'. |
|
| 302 | 302 | $this->em->getConfiguration() |
| 303 | 303 | ->getQuoteStrategy() |
| 304 | 304 | ->getTableName($class, $platform); |
@@ -315,8 +315,8 @@ discard block |
||
| 315 | 315 | ClassMetadata $class, |
| 316 | 316 | AbstractPlatform $platform |
| 317 | 317 | ): string { |
| 318 | - if (isset($assoc['joinTable']['schema']) && ! method_exists($class, 'getSchemaName')) { |
|
| 319 | - return $assoc['joinTable']['schema'] . '.' . |
|
| 318 | + if (isset($assoc['joinTable']['schema']) && !method_exists($class, 'getSchemaName')) { |
|
| 319 | + return $assoc['joinTable']['schema'].'.'. |
|
| 320 | 320 | $this->em->getConfiguration() |
| 321 | 321 | ->getQuoteStrategy() |
| 322 | 322 | ->getJoinTableName($assoc, $class, $platform); |
@@ -329,6 +329,6 @@ discard block |
||
| 329 | 329 | { |
| 330 | 330 | $tableIdentifier = new Identifier($tableName); |
| 331 | 331 | |
| 332 | - return 'DELETE FROM ' . $tableIdentifier->getQuotedName($platform); |
|
| 332 | + return 'DELETE FROM '.$tableIdentifier->getQuotedName($platform); |
|
| 333 | 333 | } |
| 334 | 334 | } |
@@ -179,7 +179,7 @@ |
||
| 179 | 179 | ]); |
| 180 | 180 | //Remove the data-* prefix for each key |
| 181 | 181 | $data = array_combine( |
| 182 | - array_map(function ($key) { |
|
| 182 | + array_map(function($key) { |
|
| 183 | 183 | if (strpos($key, 'data-') === 0) { |
| 184 | 184 | return substr($key, 5); |
| 185 | 185 | } |