Update the extension

This commit is contained in:
Ener-Getick 2016-08-04 22:36:20 +02:00
parent cbd0b453ce
commit 8c71270c66
No known key found for this signature in database
GPG Key ID: 9E5D2DB67BF054DD
2 changed files with 5 additions and 1 deletions

View File

@ -11,6 +11,7 @@
namespace EXSyst\Bundle\ApiDocBundle\DependencyInjection; namespace EXSyst\Bundle\ApiDocBundle\DependencyInjection;
use FOS\RestBundle\Controller\Annotations\ParamInterface;
use Nelmio\ApiDocBundle\Annotation\ApiDoc; use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use phpDocumentor\Reflection\DocBlockFactory; use phpDocumentor\Reflection\DocBlockFactory;
use Swagger\Annotations\Swagger; use Swagger\Annotations\Swagger;
@ -49,6 +50,9 @@ class EXSystApiDocExtension extends Extension
if (class_exists(Swagger::class)) { if (class_exists(Swagger::class)) {
$loader->load('swagger_php.xml'); $loader->load('swagger_php.xml');
} }
if (interface_exists(ParamInterface::class)) {
$loader->load('fos_rest.xml');
}
$bundles = $container->getParameter('kernel.bundles'); $bundles = $container->getParameter('kernel.bundles');
// ApiPlatform support // ApiPlatform support

View File

@ -32,7 +32,7 @@ class FosRestDescriber implements RouteDescriberInterface
public function describe(Swagger $api, Route $route, \ReflectionMethod $reflectionMethod) public function describe(Swagger $api, Route $route, \ReflectionMethod $reflectionMethod)
{ {
$annotations = $this->annotationReader->getMethodAnnotations(); $annotations = $this->annotationReader->getMethodAnnotations($reflectionMethod);
$annotations = array_filter($annotations, function ($value) { $annotations = array_filter($annotations, function ($value) {
return $value instanceof RequestParam || $value instanceof QueryParam; return $value instanceof RequestParam || $value instanceof QueryParam;
}); });