create context class
This commit is contained in:
31
core/lib/Thelia/Core/Context.php
Normal file
31
core/lib/Thelia/Core/Context.php
Normal 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';
|
||||||
|
}
|
||||||
@@ -27,7 +27,7 @@ namespace Thelia\Core\DependencyInjection;
|
|||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Thelia\Core\Security\SecurityContext;
|
use Thelia\Core\Context;
|
||||||
|
|
||||||
class ContainerAwareAdmin implements ContainerAwareInterface {
|
class ContainerAwareAdmin implements ContainerAwareInterface {
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ class ContainerAwareAdmin implements ContainerAwareInterface {
|
|||||||
*/
|
*/
|
||||||
public function setContainer(ContainerInterface $container = null)
|
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;
|
$this->container = $container;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,13 +23,12 @@
|
|||||||
namespace Thelia\Core\HttpFoundation;
|
namespace Thelia\Core\HttpFoundation;
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request as BaseRequest;
|
use Symfony\Component\HttpFoundation\Request as BaseRequest;
|
||||||
use Thelia\Core\Security\SecurityContext;
|
use Thelia\Core\Context;
|
||||||
|
|
||||||
|
|
||||||
class Request extends BaseRequest
|
class Request extends BaseRequest
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $context = SecurityContext::CONTEXT_FRONT_OFFICE;
|
protected $context = Context::CONTEXT_FRONT_OFFICE;
|
||||||
|
|
||||||
public function getProductId()
|
public function getProductId()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user