Merge branch 'master' into rewrite

Conflicts:
	core/lib/Thelia/Controller/BaseController.php
	install/insert.sql
This commit is contained in:
Etienne Roudeix
2013-09-04 10:06:22 +02:00
27 changed files with 472 additions and 112 deletions

View File

@@ -31,14 +31,13 @@ use Thelia\Tools\Redirect;
use Thelia\Core\Template\ParserContext;
use Thelia\Core\Event\ActionEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Thelia\Core\Factory\ActionEventFactory;
use Thelia\Form\BaseForm;
use Thelia\Form\Exception\FormValidationException;
use Symfony\Component\EventDispatcher\Event;
use Thelia\Core\Event\DefaultActionEvent;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
*
* The defaut administration controller. Basically, display the login form if
@@ -203,6 +202,25 @@ class BaseController extends ContainerAware
if (null !== $url) $this->redirect($url);
}
/**
* Get a route path from the route id.
*
* @param $routerName
* @param $routeId
*
* @return mixed
* @throws InvalidArgumentException
*/
protected function getRouteFromRouter($routerName, $routeId) {
$route = $this->container->get($routerName)->getRouteCollection()->get($routeId);
if ($route == null) {
throw new InvalidArgumentException(sprintf("Route ID '%s' does not exists.", $routeId));
}
return $route->getPath();
}
/**
* Return a 404 error
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
@@ -211,4 +229,4 @@ class BaseController extends ContainerAware
{
throw new NotFoundHttpException();
}
}
}