create controller for front office
This commit is contained in:
@@ -55,12 +55,6 @@
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
|
||||
<service id="thelia.controller_listener" class="Thelia\Core\EventListener\ControllerListener" scope="request">
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
<argument type="service" id="thelia.parser.context"/>
|
||||
</service>
|
||||
|
||||
|
||||
<!--
|
||||
A ControllerResolver that supports "a:b:c", "service:method" and class::method" notations,
|
||||
thus allowing the definition of controllers as service (see http://symfony.com/fr/doc/current/cookbook/controller/service.html)
|
||||
|
||||
@@ -42,12 +42,12 @@
|
||||
<argument>%thelia.core_dir%/Config/Resources/routing</argument>
|
||||
</service>
|
||||
|
||||
<service id="router.admin.xmlLoader" class="Symfony\Component\Routing\Loader\XmlFileLoader">
|
||||
<service id="router.xmlLoader" class="Symfony\Component\Routing\Loader\XmlFileLoader">
|
||||
<argument type="service" id="router.admin.fileLocator"/>
|
||||
</service>
|
||||
|
||||
<service id="router.admin" class="%router.class%">
|
||||
<argument type="service" id="router.admin.xmlLoader"/>
|
||||
<argument type="service" id="router.xmlLoader"/>
|
||||
<argument>admin.xml</argument>
|
||||
<argument type="collection">
|
||||
<argument key="cache_dir">%kernel.cache_dir%</argument>
|
||||
@@ -56,6 +56,16 @@
|
||||
<argument type="service" id="request.context"/>
|
||||
</service>
|
||||
|
||||
<service id="router.front" class="%router.class%">
|
||||
<argument type="service" id="router.xmlLoader"/>
|
||||
<argument>front.xml</argument>
|
||||
<argument type="collection">
|
||||
<argument key="cache_dir">%kernel.cache_dir%</argument>
|
||||
<argument key="debug">%kernel.debug%</argument>
|
||||
</argument>
|
||||
<argument type="service" id="request.context"/>
|
||||
</service>
|
||||
|
||||
<service id="router.chainRequest" class="%router.chainRouter.class%">
|
||||
<call method="setContext">
|
||||
<argument type="service" id="request.context"/>
|
||||
@@ -64,10 +74,15 @@
|
||||
<argument type="service" id="router.default_route"/>
|
||||
<argument>-255</argument>
|
||||
</call>
|
||||
|
||||
<call method="add">
|
||||
<argument type="service" id="router.admin"/>
|
||||
<argument>0</argument>
|
||||
</call>
|
||||
<call method="add">
|
||||
<argument type="service" id="router.front"/>
|
||||
<argument>255</argument>
|
||||
</call>
|
||||
</service>
|
||||
|
||||
<service id="listener.router" class="Symfony\Component\HttpKernel\EventListener\RouterListener">
|
||||
|
||||
@@ -6,39 +6,39 @@
|
||||
|
||||
<!-- Route to administration base -->
|
||||
<route id="admin" path="/admin">
|
||||
<default key="_controller">Thelia\Admin\Controller\AdminController::indexAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\AdminController::indexAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Route to the administration login page -->
|
||||
<route id="admin.login" path="/admin/login">
|
||||
<default key="_controller">Thelia\Admin\Controller\SessionController::showLoginAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\SessionController::showLoginAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Route to the administration logout page -->
|
||||
<route id="admin.logout" path="/admin/logout">
|
||||
<default key="_controller">Thelia\Admin\Controller\SessionController::checkLogoutAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\SessionController::checkLogoutAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Route to the login check controller -->
|
||||
<route id="admin.checklogin" path="/admin/checklogin">
|
||||
<default key="_controller">Thelia\Admin\Controller\SessionController::checkLoginAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\SessionController::checkLoginAction</default>
|
||||
</route>
|
||||
|
||||
|
||||
<!-- Route to the catalog controller (process category browsing) -->
|
||||
|
||||
<route id="admin.catalog" path="/admin/catalog">
|
||||
<default key="_controller">Thelia\Admin\Controller\CategoryController::indexAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\CategoryController::indexAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.category" path="/admin/catalog/category">
|
||||
<default key="_controller">Thelia\Admin\Controller\CategoryController::processAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\CategoryController::processAction</default>
|
||||
</route>
|
||||
|
||||
<!-- The default route, to display a template -->
|
||||
|
||||
<route id="admin.processTemplate" path="/admin/{template}">
|
||||
<default key="_controller">Thelia\Admin\Controller\AdminController::processTemplateAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\AdminController::processTemplateAction</default>
|
||||
<requirement key="template">.*</requirement>
|
||||
</route>
|
||||
</routes>
|
||||
11
core/lib/Thelia/Config/Resources/routing/front.xml
Normal file
11
core/lib/Thelia/Config/Resources/routing/front.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="customer.create" path="customer/create">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::createAction</default>
|
||||
</route>
|
||||
|
||||
</routes>
|
||||
@@ -23,7 +23,9 @@
|
||||
|
||||
namespace Thelia\Admin\Controller;
|
||||
|
||||
class AdminController extends BaseAdminController {
|
||||
use Thelia\Controller\BaseController;
|
||||
|
||||
class AdminController extends BaseController {
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
@@ -26,8 +26,9 @@ namespace Thelia\Admin\Controller;
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Core\Security\Exception\AuthenticationException;
|
||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
||||
use Thelia\Controller\BaseController;
|
||||
|
||||
class CategoryController extends BaseAdminController {
|
||||
class CategoryController extends BaseController {
|
||||
|
||||
protected function createNewCategory($args) {
|
||||
$this->dispatchEvent("createCategory");
|
||||
@@ -32,8 +32,9 @@ use Symfony\Component\Validator\Exception\ValidatorException;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Tools\Redirect;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Controller\BaseController;
|
||||
|
||||
class SessionController extends BaseAdminController {
|
||||
class SessionController extends BaseController {
|
||||
|
||||
public function showLoginAction()
|
||||
{
|
||||
@@ -20,12 +20,12 @@
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Admin\Controller;
|
||||
namespace Thelia\Controller;
|
||||
|
||||
use Symfony\Component\Routing\RequestContext;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
|
||||
use Thelia\Core\DependencyInjection\ContainerAwareAdmin;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
@@ -51,7 +51,7 @@ use Thelia\Core\Security\Exception\AuthorizationException;
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
|
||||
class BaseAdminController extends ContainerAwareAdmin
|
||||
class BaseController extends ContainerAware
|
||||
{
|
||||
const TEMPLATE_404 = "404";
|
||||
|
||||
36
core/lib/Thelia/Controller/Front/CustomerController.php
Normal file
36
core/lib/Thelia/Controller/Front/CustomerController.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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\Controller\Front;
|
||||
|
||||
use Thelia\Controller\BaseController;
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
|
||||
class CustomerController extends BaseController {
|
||||
|
||||
public function createAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,7 +33,7 @@ class CustomerCreation extends BaseForm
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("auto_login", "boolean")
|
||||
->add("auto_login", "integer")
|
||||
->add("firstname", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
|
||||
Reference in New Issue
Block a user