mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-03-10 09:36:10 +03:00
#138 Added section grouping as a higher level key to the resources array
This commit is contained in:
parent
b4792d1cd5
commit
9c601664d1
@ -127,17 +127,19 @@ abstract class AbstractFormatter implements FormatterInterface
|
|||||||
{
|
{
|
||||||
$array = array();
|
$array = array();
|
||||||
foreach ($collection as $coll) {
|
foreach ($collection as $coll) {
|
||||||
if(is_null($coll['annotation']->getSection())) {
|
$array[$coll['annotation']->getSection()][$coll['resource']][] = $coll['annotation']->toArray();
|
||||||
$array[$coll['resource']][] = $coll['annotation']->toArray();
|
|
||||||
} else {
|
|
||||||
$array[$coll['annotation']->getSection()][] = $coll['annotation']->toArray();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$processedCollection = array();
|
$processedCollection = array();
|
||||||
foreach ($array as $path => $annotations) {
|
foreach ($array as $section => $resources) {
|
||||||
foreach ($annotations as $annotation) {
|
foreach ($resources as $path => $annotations) {
|
||||||
$processedCollection[$path][] = $this->processAnnotation($annotation);
|
foreach ($annotations as $annotation) {
|
||||||
|
if($section) {
|
||||||
|
$processedCollection[$section][$path][] = $this->processAnnotation($annotation);
|
||||||
|
} else {
|
||||||
|
$processedCollection['others'][$path][] = $this->processAnnotation($annotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user