REST API: sort the classes before adding them to Restler.
The Restler API Explorer shows the classes in the order they are added and it's a mess if they are not sorted.
This commit is contained in:
parent
f6eac2b643
commit
9f526c512d
@ -65,6 +65,8 @@ $api->r->addAPIClass('Luracast\\Restler\\Explorer');
|
|||||||
$api->r->setSupportedFormats('JsonFormat', 'XmlFormat');
|
$api->r->setSupportedFormats('JsonFormat', 'XmlFormat');
|
||||||
$api->r->addAuthenticationClass('DolibarrApiAccess','');
|
$api->r->addAuthenticationClass('DolibarrApiAccess','');
|
||||||
|
|
||||||
|
$listofapis = array();
|
||||||
|
|
||||||
$modulesdir = dolGetModulesDirs();
|
$modulesdir = dolGetModulesDirs();
|
||||||
foreach ($modulesdir as $dir)
|
foreach ($modulesdir as $dir)
|
||||||
{
|
{
|
||||||
@ -117,7 +119,7 @@ foreach ($modulesdir as $dir)
|
|||||||
if (class_exists($classname))
|
if (class_exists($classname))
|
||||||
{
|
{
|
||||||
dol_syslog("Found API classname=".$classname);
|
dol_syslog("Found API classname=".$classname);
|
||||||
$api->r->addAPIClass($classname);
|
$listofapis[] = $classname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,6 +130,14 @@ foreach ($modulesdir as $dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort the classes before adding them to Restler. The Restler API Explorer
|
||||||
|
// shows the classes in the order they are added and it's a mess if they are
|
||||||
|
// not sorted.
|
||||||
|
sort($listofapis);
|
||||||
|
foreach ($listofapis as $classname)
|
||||||
|
{
|
||||||
|
$api->r->addAPIClass($classname);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO If not found, redirect to explorer
|
// TODO If not found, redirect to explorer
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user