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 890431b9560..580e308f47a 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 authMethods = new HashSet<>(); + List authMethods = new ArrayList(); List operationList = (List) 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 3d822e56f29..864fa5cd80f 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Api/PetApiInterface.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Api/PetApiInterface.php @@ -43,15 +43,6 @@ use OpenAPI\Server\Model\Pet; interface PetApiInterface { - /** - * Sets authentication method api_key - * - * @param string $value Value of the api_key authentication method. - * - * @return void - */ - public function setapi_key($value); - /** * Sets authentication method petstore_auth * @@ -61,6 +52,15 @@ interface PetApiInterface */ public function setpetstore_auth($value); + /** + * Sets authentication method api_key + * + * @param string $value Value of the api_key authentication method. + * + * @return void + */ + public function setapi_key($value); + /** * Operation addPet *