diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java index 890431b95605ff31010be402f271c2c1b18cd599..580e308f47aaca489b64779cd50fd1ab730bb6d8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java @@ -386,7 +386,7 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg operations.put("controllerName", toControllerName((String) operations.get("pathPrefix"))); operations.put("symfonyService", toSymfonyService((String) operations.get("pathPrefix"))); - HashSet<CodegenSecurity> authMethods = new HashSet<>(); + List<CodegenSecurity> authMethods = new ArrayList<CodegenSecurity>(); List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation"); for (CodegenOperation op : operationList) { @@ -431,7 +431,11 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg // Add operation's authentication methods to whole interface if (op.authMethods != null) { - authMethods.addAll(op.authMethods); + for (CodegenSecurity am : op.authMethods) { + if (!authMethods.contains(am)) { + authMethods.add(am); + } + } } } diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Api/PetApiInterface.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Api/PetApiInterface.php index 3d822e56f29951fef83d3063dfdedfad9aeeed57..864fa5cd80f572343ca58661530b7211c54498a1 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Api/PetApiInterface.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Api/PetApiInterface.php @@ -44,22 +44,22 @@ interface PetApiInterface { /** - * Sets authentication method api_key + * Sets authentication method petstore_auth * - * @param string $value Value of the api_key authentication method. + * @param string $value Value of the petstore_auth authentication method. * * @return void */ - public function setapi_key($value); + public function setpetstore_auth($value); /** - * Sets authentication method petstore_auth + * Sets authentication method api_key * - * @param string $value Value of the petstore_auth authentication method. + * @param string $value Value of the api_key authentication method. * * @return void */ - public function setpetstore_auth($value); + public function setapi_key($value); /** * Operation addPet