Pārlūkot izejas kodu

fix EnumProvider

Olivier Massot 2 gadi atpakaļ
vecāks
revīzija
744db6f647

+ 0 - 0
src/ApiResource/.gitignore


+ 5 - 5
src/State/Provider/Enum/EnumProvider.php

@@ -38,12 +38,12 @@ final class EnumProvider implements ProviderInterface
             throw new RuntimeException('not supported', 500);
         }
 
-        $id = $uriVariables['id'];
+        $name = $uriVariables['name'];
         $enums = $this->parameterBag->get('opentalent.enum');
-        $enumClass = $enums['opentalent'][$id];
+        $enumClass = $enums[$name];
 
         if(!$enumClass) {
-            throw new NotFoundHttpException(sprintf('Enum %s does\'nt exist', $id));
+            throw new NotFoundHttpException(sprintf('Enum %s does\'nt exist', $name));
         }
 
         try{
@@ -52,11 +52,11 @@ final class EnumProvider implements ProviderInterface
                 'toArray'
             );
         }catch (Exception){
-            throw new NotFoundHttpException(sprintf('Enum %s does\'nt exist', $id));
+            throw new NotFoundHttpException(sprintf('Enum %s does\'nt exist', $name));
         }
 
         $enumResponse = new Enum();
-        $enumResponse->setName($id);
+        $enumResponse->setName($name);
         $enumResponse->setItems($items);
         return $enumResponse;
     }