Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8879789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:01:47+00:00 2026-06-14T20:01:47+00:00

Let me explain the case in further details because the title doesn’t explain it

  • 0

Let me explain the case in further details because the title doesn’t explain it very well without being too long.

I’m building a mini framework on top of SF2 to use with our legacy system. We developed a mini, simple plugin system, each plugin will have its own routing.xml which may look like this:

routes:
  admin_plugins:
    pattern:  /manager/
    defaults: { _controller: plugins\riCore\AdminController::indexAction }

We want to obviously add these routes into the routeCollection, but there is 1 tweak: we want to prepend the route pattern and id with the plugin name. We used to loop through the list of plugin and do it manually like this:

self::$container->get('router')->getRouteCollection()->add($plugin_lc_name . '_' . $key, new Route($route['pattern'], $route['defaults'], $route['requirements'], $route['options']));

However, now that we moved to use SF2 kernel and do a compilation of the container, we began to run into this problem:

[21-Oct-2012 08:40:57] PHP Fatal error:  Call to undefined method Symfony\Component\Routing\RouteCollection::__set_state() in plugins\cache\prod\pluginsProdProjectContainer.php on line 791

So I figured it could be due to the fact that we tried to getRouteCollection() the too soon and perhaps there must be a way around?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:01:48+00:00Added an answer on June 14, 2026 at 8:01 pm

    To answer my question, yes it seems to work. I just haven’t found a way to make SF2 cache those routes yet. Below is part of the code I’m using to add dynamic routes. As you can see I want to add certain prefixes to routes

    $plugin_lc_name = strtolower($plugin);
                    foreach ($plugins_settings[$plugin]['routes'] as $key => $route) {
                        $route = array_merge(array('pattern'      => '',
                                                   'defaults'     => array(),
                                                   'requirements' => array(),
                                                   'options'      => array()), $route);
                        if (strpos($route['pattern'], '/') !== false)
                            $route['pattern'] = $plugin_lc_name . $route['pattern'];
                        else
                            $route['pattern'] = $plugin_lc_name . '_' . $route['pattern'];
    
                        $container::get('router')->getRouteCollection()->add($plugin_lc_name . '_' . $key, new Route($route['pattern'], $route['defaults'], $route['requirements'], $route['options']));
                    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The title may be long, let me explain what I mean. I won't give
Sorry if my title is hard to understand. Let me explain. To use this
It's difficult to explain the case by words, let me give an example: var
Let me explain the basic layout below: |----------------------------| | title banner | | |
I apologize for vague title so let me explain. Suppose you have a page
Let me explain the use case... In a simple python web application framework designed
Let me try to explain My case, I have two table and each of
The title of my question may be unclear, so let me explain what's the
But of a confusing title so let me explain. I have an array of
Let me explain best with an example. Say you have node class that can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.