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();
|
||||
foreach ($collection as $coll) {
|
||||
if(is_null($coll['annotation']->getSection())) {
|
||||
$array[$coll['resource']][] = $coll['annotation']->toArray();
|
||||
} else {
|
||||
$array[$coll['annotation']->getSection()][] = $coll['annotation']->toArray();
|
||||
}
|
||||
$array[$coll['annotation']->getSection()][$coll['resource']][] = $coll['annotation']->toArray();
|
||||
}
|
||||
|
||||
$processedCollection = array();
|
||||
foreach ($array as $path => $annotations) {
|
||||
foreach ($annotations as $annotation) {
|
||||
$processedCollection[$path][] = $this->processAnnotation($annotation);
|
||||
foreach ($array as $section => $resources) {
|
||||
foreach ($resources as $path => $annotations) {
|
||||
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