Route: possibility to replace routes in modules

This commit is contained in:
r.ratsun
2017-11-13 16:51:25 +02:00
parent 83a6a8663d
commit 76471a6db1

View File

@@ -112,17 +112,27 @@ class Route
}
}
/**
* Unify routes
*
* @return array
*/
protected function unify()
{
$data = array();
$data = $this->getAddData($data, $this->paths['customPath']);
// for custom
$data = $this->getAddData([], $this->paths['customPath']);
// for module
$moduleData = [];
foreach ($this->getMetadata()->getModuleList() as $moduleName) {
$modulePath = str_replace('{*}', $moduleName, $this->paths['modulePath']);
$data = $this->getAddData($data, $modulePath);
foreach ($this->getAddData([], $modulePath) as $row) {
$moduleData[$row['method'].$row['route']] = $row;
}
}
$data = array_merge($data, array_values($moduleData));
// for core
$data = $this->getAddData($data, $this->paths['corePath']);
return $data;