create context class

This commit is contained in:
Manuel Raynaud
2013-08-12 12:38:23 +02:00
parent 3a3cba04bf
commit 298c13ce1f
3 changed files with 35 additions and 5 deletions

View File

@@ -0,0 +1,31 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core;
class Context
{
const CONTEXT_FRONT_OFFICE = 'front';
const CONTEXT_BACK_OFFICE = 'admin';
}

View File

@@ -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;
}
}

View File

@@ -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()
{