mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Merge pull request #645 from ogizanagi/dunglas/filters_collection_only
Only display filters on collections GET services
This commit is contained in:
commit
a679eb8089
@ -19,6 +19,7 @@ use Dunglas\ApiBundle\Mapping\ClassMetadataFactoryInterface;
|
|||||||
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
||||||
use Nelmio\ApiDocBundle\Extractor\AnnotationsProviderInterface;
|
use Nelmio\ApiDocBundle\Extractor\AnnotationsProviderInterface;
|
||||||
use Nelmio\ApiDocBundle\Parser\DunglasApiParser;
|
use Nelmio\ApiDocBundle\Parser\DunglasApiParser;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates ApiDoc annotations for DunglasApiBundle.
|
* Creates ApiDoc annotations for DunglasApiBundle.
|
||||||
@ -125,12 +126,14 @@ class DunglasApiProvider implements AnnotationsProviderInterface
|
|||||||
$data['output'] = sprintf('%s:%s', DunglasApiParser::OUT_PREFIX, $entityClass);
|
$data['output'] = sprintf('%s:%s', DunglasApiParser::OUT_PREFIX, $entityClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Request::METHOD_GET === $method && $collection) {
|
||||||
$data['filters'] = [];
|
$data['filters'] = [];
|
||||||
foreach ($resource->getFilters() as $filter) {
|
foreach ($resource->getFilters() as $filter) {
|
||||||
foreach ($filter->getDescription($resource) as $name => $definition) {
|
foreach ($filter->getDescription($resource) as $name => $definition) {
|
||||||
$data['filters'][] = ['name' => $name] + $definition;
|
$data['filters'][] = ['name' => $name] + $definition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$apiDoc = new ApiDoc($data);
|
$apiDoc = new ApiDoc($data);
|
||||||
$apiDoc->setRoute($route);
|
$apiDoc->setRoute($route);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user