change context by Class and service context
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user