Symfony CommonBundle

With symphony I have AdminBundle, UserBundle and ApiBundle
Instead of adding all bundles in AppKernel.php at once, I want to create a KernelBooter to determine the query request (e.g.… or then load the appropriate xKernel.php (e.g. UserKernel.php) to load the appropriate bundle (e.g. UserBundle)
But there are lots of services that are common between AdminBundle, UserBundle etc. like ‘doctrine’ service and this service requires to load entities from a bundle and exceptionListener etc.
I was thinking to create a CommonBundle that loads doctrine/email/blah services and entities and each UserKernel.php, AdminKernel.php loads CommonBundle as well as its own related bundle.
Now my question is that doing these all is good practice and reasonable? or is there any better way to go?

What’s the goal here? Performance? Classes are already autoloaded, so I doubt you’ll see much boost. It would be a good idea to run some benchmarks first so you know whether this will have any significant impact before you invest a lot of time and effort.

Also, the more often you do weird things in the framework, the less likely other people will be able to help you through it.

I’m mistaken Drupal doesn’t use the concept of Bundles. Instead the standard Symfony Kernel is replaced and what are referred to as “Service Providers” can be registered to manipulate the DI Container configuration before compiling the container. That is all done in core/lib/Drupal/Core/DrupalKernel.php if you’re interested. The concept is essentially the same though as a manually created “bundle” in Symfony.

Came across this which might be of some help.

From docs I see config.yml and services.yml are possible to be converted in php with
$container->loadExtension or ->register().

  1. How is possible to convert parameters.yml in php?
  2. Request is a good tool to fetch post and get vars, so how can I disable $_POST in my code that if there would a $_POST in my code it throws exception like phpBB does?
  3. I guess router/controller system is not good for applications like whmcs that want to allow users to add custom pages as adding custom pages is difficult for end-users with router/controller system? Or I am wrong?
  4. What is the purpose of xBundle.php file extending Bundle class? This is in root folder of /src/Bundle/…

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.