change context by Class and service context

This commit is contained in:
Manuel Raynaud
2013-08-12 14:49:43 +02:00
parent b505d785ca
commit b4c4898374
4 changed files with 24 additions and 1 deletions

View File

@@ -34,8 +34,23 @@ class Context
self::CONTEXT_FRONT_OFFICE
);
protected $currentContext = self::CONTEXT_FRONT_OFFICE;
public function isValidContext($context)
{
return in_array($context, $this->defineContext);
}
public function setContext($context)
{
if($this->isValidContext($context))
{
$this->currentContext = $context;
}
}
public function getContext()
{
return $this->currentContext;
}
}

View File

@@ -47,7 +47,7 @@ class ContainerAwareAdmin implements ContainerAwareInterface {
*/
public function setContainer(ContainerInterface $container = null)
{
$container->get('request')->setContext(Context::CONTEXT_BACK_OFFICE);
$container->get('thelia.envContext')->setContext(Context::CONTEXT_BACK_OFFICE);
$this->container = $container;
}
}