Commit 259242c4 authored by dj3c1t's avatar dj3c1t

parameters dans default_route

parent 2a2c9dde
......@@ -7,12 +7,28 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller {
public function indexAction() {
$default_route = array(
"route" => "admin",
"parameters" => array(),
);
$defaultRouteParameter = $this->container->getParameter("default_route");
if($defaultRouteParameter) {
if(is_array($defaultRouteParameter)) {
if(isset($defaultRouteParameter['route'])) {
$default_route['route'] = $defaultRouteParameter['route'];
}
if(isset($defaultRouteParameter['parameters']) && is_array($defaultRouteParameter['parameters'])) {
foreach($defaultRouteParameter['parameters'] as $key => $value) {
$default_route['parameters'][$key] = $value;
}
}
}
else {
$default_route['route'] = $defaultRouteParameter;
}
}
return $this->redirect(
$this->generateUrl(
$this->container->hasParameter("default_route") ?
$this->container->getParameter("default_route")
: "admin"
)
$this->generateUrl($default_route['route'], $default_route['parameters'])
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment