Giter Club home page Giter Club logo

multisite-bundle's People

Contributors

cedricblondeau avatar h4cc avatar pborreli avatar sanderborgman avatar seblevdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

multisite-bundle's Issues

Cannot import resource (Unknown property 'paths' on annotation 'Sensio\Bundle\FrameworkExtraBundle\Configuration\Route'.)

Hi, during a test was thrown this exception:

FileLoaderLoadException: Cannot import resource "C:\xampp\htdocs\---\src\Gp\CoreBundle/Controller/HomeController.php" from "C:\xampp\htdocs\---\src\Gp\CoreBundle/Resources/config/routing.yml". (Unknown property 'paths' on annotation 'Sensio\Bundle\FrameworkExtraBundle\Configuration\Route'.)

this is my Controller class

namespace Gp\CoreBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;

/**
 * @Route("/")
 */
class HomeController extends Controller
{
    /**
     * @Route(name="gp_core_homepage", paths={
     *   "world_site"={
     *     "en_GB"="/",
     *   },
     *   "russian_site"={
     *     "ru_RU"="/",
     *   },
     * })
     * @Method({"GET"})
     * @Template("GpCoreBundle:Home:index.html.twig")
     */
    public function indexAction()
    {
        return array();
    }
}

The bundle was configured properly as described in the docs... what's wrong?
I use symfony 2.5.

PS: Does this bundle natively support also subdomains on "host"?

Avoid the generated route in the cache

I try you bundle in my sanbox. But I have this error, with app_dev.php:
No route found for "GET /"

Or I my controller I have:

namespace Sandbox\PageBundle\Controller

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Alex\MultisiteBundle\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;

class DefaultController extends Controller
{
    /**
     * @Route("/")
     * @Method({"GET"})
     * @Template()
     */
    public function homepageAction()
    {
        die(var_dump($this->get('site_context')->getCurrentLocale()));
        return array();
    }
}

In my routing.yml, I have this:

sandbox_page:
    resource: "@SandBoxPageBundle/Controller/"
    type:     annotation
    prefix:   /

I think the route are generated in cache, because when I delete the cache directory I don't have error.

So I would like to know if it's possible to avoid removing the cover lorsuqe we add a new route, with app_dev.php

Sf 2.8.6 , multisite-bundle 0.1.1 is breaking the debugtoolbar

Hi.

It's my first issues , i hope it will help the community.

the error

The profiler template "@WebProfiler/Collector/request.html.twig" for data collector "request" does not exist. 500 Internal Server Error - UnexpectedValueException

From what i see in the xdebug.

WebProfilerBundle/Profiler/TemplateManager.php l : 125 :
The problem is at this line.

$loader = $this->twig->getLoader();

When the framework want to check if the template "@WebProfiler/Collector/request.html.twig" is loaded.

The code is looking in the wrong loader

He should have a look inside the loader "Sf\Bundle\TwigBundle\Loader\FilesystemLoader"

And now he is looking inside "Alex\MultiwebsiteBundle\Twig\MultisteLoader".
which this one have a paths array empty.

I can hart fix it , but it's ugly, tell me.
How can i help you to fixe this issue :)

thanks.

Symfony2 firewall doesn't hook "check_path" and "logout" routes

For brevity I omitted the parts of not essential code.

app/config/config.yml:

alex_multisite:
    default_branding: world_site
    default_locale:   %locale%
    brandings:
        _defaults:
            active: true
        world_site:
            en: { host: %domain_world_site% }
        admin_control_panel:
            _defaults:
                active: true
            en: { host: %domain_admin_control_panel% }

app/config/security.yml:

firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        admin_control_panel:
            provider: administrators
            context: %domain_admin_control_panel%
            host: %domain_admin_control_panel%
            pattern: ^/
            anonymous: ~
            form_login:
                # Login paths:
                login_path: security_admin_login
                check_path: security_admin_login_check
                # Login success options
                always_use_default_target_path: true
                default_target_path: gp_admin_dashboard
                # Login failed options
                failure_path: security_admin_login
                # Login options
                username_parameter: email
                password_parameter: password
                # Remember me disabled on admin!
                remember_me: false
                # Token csrf options
                csrf_provider: form.csrf_provider
                csrf_parameter: _auth_token
            logout:
                # Logout paths
                path: security_admin_logout
                target: security_admin_login
                # Logout options
                invalidate_session: true # the authenticated session will be unavailable afterwards

    access_control:
        - { host: %domain_admin_control_panel%, path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, methods: [GET] }
        - { host: %domain_admin_control_panel%, path: ^/login_check, roles: IS_AUTHENTICATED_ANONYMOUSLY, methods: [POST] }
        - { host: %domain_admin_control_panel%, path: ^/, roles: ROLE_ADMIN }

app/config/routing.yml:

gp_admin:
    resource: "@GpAdminBundle/Resources/config/routing.yml"

Resources/config/routing.yml:

gp_admin_dashboard:
    resource: "@GpAdminBundle/Controller/DashboardController.php"
    type: annotation

gp_admin_security:
    resource: "@GpAdminBundle/Controller/SecurityController.php"
    type: annotation

SecurityController:

use Alex\MultisiteBundle\Annotation\Route;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\SecurityContextInterface;


class SecurityController extends Controller
{
    /**
     * @Route(name="security_admin_login", paths={
     *   "admin_control_panel"={
     *     "en"="/login",
     *   },
     * })
     * @Method({"GET"})
     */
    public function loginAction(Request $request)
    {
        $session = $request->getSession();
        // errors verify
        if ($request->attributes->has(SecurityContextInterface::AUTHENTICATION_ERROR)) {
            $error = $request->attributes->get(SecurityContextInterface::AUTHENTICATION_ERROR);
        } elseif (null !== $session && $session->has(SecurityContextInterface::AUTHENTICATION_ERROR)) {
            $error = $session->get(SecurityContextInterface::AUTHENTICATION_ERROR);
            $session->remove(SecurityContextInterface::AUTHENTICATION_ERROR);
        } else {
            $error = '';
        }

        if ($error) {
            $error = $error->getMessage();
        }

        $csrfToken = $this->container->get('form.csrf_provider')->generateCsrfToken('authenticate');

        return $this->render('GpAdminBundle:Security:login.html.twig', array(
            'error' => $error,
            'csrf_token' => $csrfToken,
            )
        );
    }

    /**
     * @Route(name="security_admin_login_check", paths={
     *   "admin_control_panel"={
     *     "en"="/login_check",
     *   },
     * })
     * @Method({"POST"})
     */
    public function checkAction()
    {
        throw new \RuntimeException('Something wrong with firewall LOGIN_CHECK configuration.');
    }

    /**
     * @Route(name="security_admin_logout", paths={
     *   "admin_control_panel"={
     *     "en"="/logout",
     *   },
     * })
     * @Method({"GET"})
     */
    public function logoutAction()
    {
        throw new \RuntimeException('Something wrong with firewall LOGOUT configuration.');
    }

php app/console router:debug:

_i18n__admin_control_panel_en__security_admin_login    ANY    ANY    admin.youintent.local /login
_i18n__admin_control_panel_en__security_admin_login_check    ANY    ANY admin.youintent.local /login_check
_i18n__admin_control_panel_en__security_admin_logout    ANY    ANY admin.youintent.local /logout
_i18n__admin_control_panel_en__gp_admin_dashboard   ANY    ANY    admin.youintent.local /

Well, with this configuration the firewall behavior is like I wrote in the title and throws the controller exception.
If I use routes without annotations like this:
Resources/config/routing.yml:

gp_admin_dashboard:
    resource: "@GpAdminBundle/Controller/DashboardController.php"
    type: annotation

gp_admin_account:
    resource: "@GpAdminBundle/Controller/AccountController.php"
    type: annotation

#gp_admin_security:
#    resource: "@GpAdminBundle/Controller/SecurityController.php"
#    type: annotation

security_admin_login:
    path: /login
    host: admin.youintent.local
    defaults: { _controller: GpAdminBundle:Security:login }

security_admin_login_check:
    path: /login_check
    host: admin.youintent.local

security_admin_logout:
    path: /logout
    host: admin.youintent.local

php app/console router:debug change in:

security_admin_login    ANY    ANY    admin.youintent.local /login
security_admin_login_check    ANY    ANY admin.youintent.local /login_check
security_admin_logout    ANY    ANY admin.youintent.local /logout
_i18n__admin_control_panel_en__gp_admin_dashboard   ANY    ANY    admin.youintent.local /

the login process is ok and user is correctly authenticated but on redirect is thrown:

Unable to generate a URL for the named route "gp_admin_dashboard" as such route does not exist

from logs:

INFO - Matched route "security_admin_login_check" (parameters: "_route": "security_admin_login_check")
INFO - User "[email protected]" has been authenticated successfully
CRITICAL - Uncaught PHP Exception Symfony\Component\Routing\Exception\RouteNotFoundException: "Unable to generate a URL for the named route "gp_admin_dashboard" as such route does not exist." at C:\xampp\htdocs\youintent\app\cache\dev\appDevUrlGenerator.php line 54 
Context: {"exception":"Object(Symfony\\Component\\Routing\\Exception\\RouteNotFoundException)"}

How can I resolve this issue premising that I would want localize and internationalize the login, logout and login_check routes, specially on my front-end subdomains?
It's possible to get it work with the annotations?
Any help will be really appreciate.

Symfony 3 Compatibility issue.

I would like to make this bundle working with Symfony 3 and trying on a fresh installation in locale (obviously I've updated the composer.json on my new branch 3.0 to allow Symfony 3) at the first attempt I got:

UndefinedMethodException,
Attempted to call an undefined method named "setSiteContext"
of class "Symfony\Bundle\FrameworkBundle\Routing\Router".
Did you mean to call "setContext"?

The problem comes from the compiler pass Alex\MultisiteBundle\DependencyInjection\Compiler\InjectSiteContextPass
it appens during the execution of
$container->findDefinition('router.default')->addMethodCall('setSiteContext', array(new Reference('site_context')));

On another fresh installation with Symfony 2.8.6 this problem not appear but after passed some time reading all the docs about Routing, Compiler Pass, DI, etc (from Symfony 2.8.6. to 3.0.6) I haven't noticed difference related to this, but maybe I've missed something.

There is someone can point me in the right direction to resolve the problem?

Using Twig_Loader_String and AlexMultisiteBundle, return a prefixed string

Hi,

I add the Twig_Loader_String for my project, and I have a problem.

When I do this :

$twig = $this->get('twig'); // twig service
$string = $twig->render('lorem ipsum');

My string contain : _[branding_name]_[locale]/lorem ipsum.
(replace [...] by your seetings)

Have you an idea how I can fix this problem ?

Thanks in advance.
Thomas

Wrong findTemplates declaration in Alex\MultisiteBundle\Twig\MultisiteLoader

Hello everyone,

When using twig version 2.x, the following error is raised.

Warning: Declaration of Alex\MultisiteBundle\Twig\MultisiteLoader::findTemplate($name) should be compatible with Twig_Loader_Filesystem::findTemplate($name, $throw = true)

You just need to update the function and set it to Alex\MultisiteBundle\Twig\MultisiteLoader::findTemplate($name, $throw = true)

Regards,

override a template using @Template

This is my test controller:

namespace Gp\CoreBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;

use Alex\MultisiteBundle\Annotation\Route;

class TestController extends Controller
{
    /**
     * @Route(name="gp_core_test", paths={
     *   "world_site"={
     *     "en"="/test",
     *   },
     *   "italian_site"={
     *     "it_IT"="/prova",
     *   },
     *   "russian_site"={
     *     "ru_RU"="/проба",
     *   },
     * })
     * @Template()
     */
    public function indexAction()
    {
        return array();
    }
}

and my base template is: @Template("GpCoreBundle:Test:index.html.twig")
As showed in the docs I would like to define different twig template based on branding + locale, but the forward slash used as separator in the docs is not allowed (for instance on file names like: _world_site_en/index.html).
After many attempts I realised that I need help once again :-(

Can't be change current branding or locale

Hi evry one,

I have this configuration

alex_multisite:
    default_branding: sandbox_france
    default_locale:   fr_FR
    brandings:
      _defaults:
        register: true
      sandbox_france:
        en: { host: sandbox_fr.localhost, prefix: /en }
        fr_FR: { host: sandbox_fr.localhost }
      sandbox_belgium:
        en_BE: { host: sandbox_be.localhost, prefix: /en }
        fr_BE: { host: sandbox_be.localhost }
      sandbox_canada:
        en_CA: { host: sandbox_ca.localhost, prefix: /en }
        fr_CA: { host: sandbox_ca.localhost }

Here is the result of the php app / console router command: debug

[router] Current routes
 Name                                          Method   Scheme Host                 Path                                               
 _wdt                                          ANY      ANY    ANY                  /_wdt/{token}                                      
 _profiler_home                                ANY      ANY    ANY                  /_profiler/                                        
 _profiler_search                              ANY      ANY    ANY                  /_profiler/search                                  
 _profiler_search_bar                          ANY      ANY    ANY                  /_profiler/search_bar                              
 _profiler_purge                               ANY      ANY    ANY                  /_profiler/purge                                   
 _profiler_info                                ANY      ANY    ANY                  /_profiler/info/{about}                            
 _profiler_import                              ANY      ANY    ANY                  /_profiler/import                                  
 _profiler_export                              ANY      ANY    ANY                  /_profiler/export/{token}.txt                      
 _profiler_phpinfo                             ANY      ANY    ANY                  /_profiler/phpinfo                                 
 _profiler_search_results                      ANY      ANY    ANY                  /_profiler/{token}/search/results                  
 _profiler                                     ANY      ANY    ANY                  /_profiler/{token}                                 
 _profiler_router                              ANY      ANY    ANY                  /_profiler/{token}/router                          
 _profiler_exception                           ANY      ANY    ANY                  /_profiler/{token}/exception                       
 _profiler_exception_css                       ANY      ANY    ANY                  /_profiler/{token}/exception.css                   
 _configurator_home                            ANY      ANY    ANY                  /_configurator/                                    
 _configurator_step                            ANY      ANY    ANY                  /_configurator/step/{index}                        
 _configurator_final                           ANY      ANY    ANY                  /_configurator/final                               
 fos_user_security_login                       ANY      ANY    ANY                  /login                                             
 fos_user_security_check                       POST     ANY    ANY                  /login_check                                       
 fos_user_security_logout                      ANY      ANY    ANY                  /logout                                            
 fos_user_profile_show                         GET      ANY    ANY                  /profile/                                          
 fos_user_profile_edit                         ANY      ANY    ANY                  /profile/edit                                      
 fos_user_registration_register                ANY      ANY    ANY                  /register/                                         
 fos_user_registration_check_email             GET      ANY    ANY                  /register/check-email                              
 fos_user_registration_confirm                 GET      ANY    ANY                  /register/confirm/{token}                          
 fos_user_registration_confirmed               GET      ANY    ANY                  /register/confirmed                                
 fos_user_resetting_request                    GET      ANY    ANY                  /resetting/request                                 
 fos_user_resetting_send_email                 POST     ANY    ANY                  /resetting/send-email                              
 fos_user_resetting_check_email                GET      ANY    ANY                  /resetting/check-email                             
 fos_user_resetting_reset                      GET|POST ANY    ANY                  /resetting/reset/{token}                           
 fos_user_change_password                      GET|POST ANY    ANY                  /change-password/change-password                   
 fos_user_group_list                           GET      ANY    ANY                  /group/list                                        
 fos_user_group_new                            ANY      ANY    ANY                  /group/new                                         
 fos_user_group_show                           GET      ANY    ANY                  /group/{groupname}                                 
 fos_user_group_edit                           ANY      ANY    ANY                  /group/{groupname}/edit
 _i18n__sandbox_france_fr_FR__news_list         ANY      ANY    sandbox3_fr.localhost /news/actualite                                    
 _i18n__sandbox_france_fr_FR__sandbox_news_show  ANY      ANY    sandbox3_fr.localhost /news/actualite/{slug}                             
 _i18n__sandbox_france_en__news_list            ANY      ANY    sandbox3_fr.localhost /news/en/news                                      
 _i18n__sandbox_france_en__sandbox_news_show     ANY      ANY    sandbox3_fr.localhost /news/en/news/{slug}                               
 _i18n__sandbox_canada_fr_CA__news_list         ANY      ANY    sandbox3_ca.localhost /news/actualite                                    
 _i18n__sandbox_canada_fr_CA__sandbox_news_show  ANY      ANY    sandbox3_ca.localhost /news/actualite/{slug}                             
 _i18n__sandbox_canada_en_CA__news_list         ANY      ANY    sandbox3_ca.localhost /news/en/news                                      
 _i18n__sandbox_canada_en_CA__sandbox_news_show  ANY      ANY    sandbox3_ca.localhost /news/en/news/{slug}                               
 _i18n__sandbox_belgium_fr_BE__news_list        ANY      ANY    sandbox3_be.localhost /news/actualite                                    
 _i18n__sandbox_belgium_fr_BE__sandbox_news_show ANY      ANY    sandbox3_be.localhost /news/actualite/{slug}                             
 _i18n__sandbox_belgium_en_BE__news_list        ANY      ANY    sandbox3_be.localhost /news/en/news                                      
 _i18n__sandbox_belgium_en_BE__sandbox_news_show ANY      ANY    sandbox3_be.localhost /news/en/news/{slug}                               

My problem is that when I want to view the domain 'sandbox_canada' is my local household communications that defines the file configurationconfig.yml, namely fr_FR.

Have you any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.