This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Bundle/FrameworkBundle/Controller/InternalController.php

48 lines
1.3 KiB
PHP
Raw Normal View History

2010-06-23 20:42:41 +01:00
<?php
namespace Symfony\Bundle\FrameworkBundle\Controller;
2010-06-23 20:42:41 +01:00
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpFoundation\Response;
2010-06-23 20:42:41 +01:00
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* InternalController.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class InternalController extends ContainerAware
2010-06-23 20:42:41 +01:00
{
/**
* Forwards to the given controller with the given path.
*
* @param string $path The path
* @param string $controller The controller name
*
* @return Response A Response instance
*/
public function indexAction($path, $controller)
2010-06-23 20:42:41 +01:00
{
$request = $this->container->get('request');
$attributes = $request->attributes;
2010-06-23 20:42:41 +01:00
2010-08-18 12:44:52 +01:00
$attributes->delete('path');
$attributes->delete('controller');
if ('none' !== $path)
2010-06-23 20:42:41 +01:00
{
parse_str($path, $tmp);
$attributes->add($tmp);
2010-06-23 20:42:41 +01:00
}
return $this->container->get('controller_resolver')->forward($controller, $attributes->all(), $request->query->all());
2010-06-23 20:42:41 +01:00
}
}