From 298c13ce1fdcee078d041dfca6aff0cbf63e6c6a Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 12 Aug 2013 12:38:23 +0200 Subject: [PATCH] create context class --- core/lib/Thelia/Core/Context.php | 31 +++++++++++++++++++ .../ContainerAwareAdmin.php | 4 +-- .../Thelia/Core/HttpFoundation/Request.php | 5 ++- 3 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 core/lib/Thelia/Core/Context.php diff --git a/core/lib/Thelia/Core/Context.php b/core/lib/Thelia/Core/Context.php new file mode 100644 index 000000000..aceb000a9 --- /dev/null +++ b/core/lib/Thelia/Core/Context.php @@ -0,0 +1,31 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core; + + +class Context +{ + const CONTEXT_FRONT_OFFICE = 'front'; + const CONTEXT_BACK_OFFICE = 'admin'; +} \ 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 e3e19d63b..b2ad967cf 100644 --- a/core/lib/Thelia/Core/DependencyInjection/ContainerAwareAdmin.php +++ b/core/lib/Thelia/Core/DependencyInjection/ContainerAwareAdmin.php @@ -27,7 +27,7 @@ namespace Thelia\Core\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Thelia\Core\Security\SecurityContext; +use Thelia\Core\Context; class ContainerAwareAdmin implements ContainerAwareInterface { @@ -47,7 +47,7 @@ class ContainerAwareAdmin implements ContainerAwareInterface { */ public function setContainer(ContainerInterface $container = null) { - $container->get('request')->setContext(SecurityContext::CONTEXT_BACK_OFFICE); + $container->get('request')->setContext(Context::CONTEXT_BACK_OFFICE); $this->container = $container; } } \ No newline at end of file diff --git a/core/lib/Thelia/Core/HttpFoundation/Request.php b/core/lib/Thelia/Core/HttpFoundation/Request.php index f3711a7dd..8c17d99f9 100755 --- a/core/lib/Thelia/Core/HttpFoundation/Request.php +++ b/core/lib/Thelia/Core/HttpFoundation/Request.php @@ -23,13 +23,12 @@ namespace Thelia\Core\HttpFoundation; use Symfony\Component\HttpFoundation\Request as BaseRequest; -use Thelia\Core\Security\SecurityContext; - +use Thelia\Core\Context; class Request extends BaseRequest { - protected $context = SecurityContext::CONTEXT_FRONT_OFFICE; + protected $context = Context::CONTEXT_FRONT_OFFICE; public function getProductId() {