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 8996367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:44:44+00:00 2026-06-15T23:44:44+00:00

I currently have Test\CoreBundle which is intend on containing basic functions to get my

  • 0

I currently have Test\CoreBundle which is intend on containing basic functions to get my website online (e.g. a splash page and basic admin panel).

What I want to do is be able to drop in Test\UserBundle and have the CoreBundle realise that I’ve added a new bundle so it can include this in the administrator panel. I thought I might be able to do something like:

In my Test\UserBundle I add a config.yml file such as:

include_admin:
    directory: "users"
    name: "User Management"

(i’d then add the bundle it to the AppKernel.php)

In my admin panel index:

$bundles = $this->container->getParameter('kernel.bundles');
foreach($bundles as $bundle){
  if(strpos($bundle,'Test') !== false){
    // access the config.yml file somehow for this bundle?
  }
}

I’d then be able to do something like this in my view:

<a href="/admin/{{ directory }}">{{ name }}</a>

I don’t know if I’m going about this completely cack-handedly due to not knowing anything about sf.

  • 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-15T23:44:44+00:00Added an answer on June 15, 2026 at 11:44 pm

    You can create a listener in CoreBundle that would listen for other Bundle’s “participation”. I’ve done something similar below to build a navigation based on menu items for any bundles I wish. You can modify the events & event listeners below to pass whatever data you need.

    Basically, you create an Event & Event Listener in CoreBundle, and have each other independent bundle register the EventListener whenever the CoreBundle dispatches an event.

    For example, in your CoreBundle, create an event:

    use Symfony\Component\EventDispatcher\Event;
    
    class BundleEvent extends Event
    {
        const EVENT = "core.bundle.find_bundles";
    
        private $bundles;
    
        public function addBundle($bundle)
        { 
             $this->bundles[] = $bundle;
        }
    
        public function getBundles()
        {
             return $this->bundles;
        }
    }
    

    Then create an event listener in your CoreBundle:

    use Acme\CoreBundle\BundleEvent;
    
    class BundleListener
    { 
        private $bundle_path;
    
        public function __construct($bundle_path)
        { 
             $this->bundle_path= $bundle_path;
        }
    
        public function addBundle(BundleEvent $event)
        {
             $event->addBundle($this->bundle_path);
        }
    }
    

    Then, in each of your Bundle’s services.xml that you want CoreBundle to be aware of, use this:

    <service id="acme.user.bundle_listener" class="Acme\CoreBundle\BundleListener">
        <argument>Acme\UserBundle</argument>
        <tag name="kernel.event_listener" event="core.bundle.find_bundles" method="addBundle" />
    </service>
    

    Finally, in your CoreBundle (or wherever else you need to get this list), when you want to get all of the bundles you are looking for, run the event through the event dispatcher:

    $bundles = $this->container->get('event_dispatcher')->dispatch(BundleEvent::EVENT, new BundleEvent())->getBundles();
    
    foreach($bundles as $bundle_path) {
        // .. do something
    }
    

    If someone else has a simpler way of accomplishing this, I’d love to know an easier/cleaner way!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note: I'm using Google Chrome Currently I have this test page http://www.evecakes.com/doodles/canvas_size_issue.htm It should
Currently I have 2 virtual test servers(win2003). One is on which websites are deployed
I currently have these pages: http://example.com/category/page/123/test-test http://example.com/category/page/2563/test2-test http://example.com/category/page/2853/test2-test I want to 301 redirect them
I currently have a test which tests the presenter I have in the MVP
We currently have a suite of integration tests that run via MbUnit test suites.
Currently I have two tests that each individually test for a button_click within a
I have a PHPUnit test suite that is currently causing a fatal error due
I have a VSTO Excel workbook that functions correctly in test. I can deploy
I currently have like 10 tests that test whenever my Tetris piece doesn't move
I currently have the regex '([^: ]+):([^ ]+)?' , which when given a string

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.