diff --git a/core/lib/Thelia/Action/BaseAction.php b/core/lib/Thelia/Action/BaseAction.php
index f827e0dbd..f351b59bb 100644
--- a/core/lib/Thelia/Action/BaseAction.php
+++ b/core/lib/Thelia/Action/BaseAction.php
@@ -152,6 +152,11 @@ class BaseAction
return $securityContext;
}
+ protected function getContext()
+ {
+ return $this->container->get("thelia.envContext");
+ }
+
protected function redirect($url, $status = 302)
{
$response = new RedirectResponse($url, $status);
diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml
index f9a55fe13..a5e593a85 100755
--- a/core/lib/Thelia/Config/Resources/config.xml
+++ b/core/lib/Thelia/Config/Resources/config.xml
@@ -60,6 +60,7 @@
+
diff --git a/core/lib/Thelia/Core/Context.php b/core/lib/Thelia/Core/Context.php
index 4d8e39bca..23c57ec2a 100644
--- a/core/lib/Thelia/Core/Context.php
+++ b/core/lib/Thelia/Core/Context.php
@@ -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;
+ }
}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/DependencyInjection/ContainerAwareAdmin.php b/core/lib/Thelia/Core/DependencyInjection/ContainerAwareAdmin.php
index b2ad967cf..3792c22cc 100644
--- a/core/lib/Thelia/Core/DependencyInjection/ContainerAwareAdmin.php
+++ b/core/lib/Thelia/Core/DependencyInjection/ContainerAwareAdmin.php
@@ -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;
}
}
\ No newline at end of file