When extending/overriding a Bundle in a Symfony (3.0.x) project one adds the according folder to the "/app/Resources" folder. I got that. What I did not get is how you know which name that folder should have.
Example: The FOSUserBundle wants a folder named "FOSUserBundle". The location of the bundle is "/vendor/friendsofsymfony/user-bundle/".
Obviously this is not the same name as the folder in the app/Resources location gets.
Where do I find the name or mapping information of a bundle that defines how to call the folder to be added? Thank you in advance!
The bundle name is the short class name (the final part of the class name without the namespace) of the actual bundle class (see the code).
A few examples..
FOS\UserBundle\FOSUserBundle -> FOSUserBundle
Sylius\Bundle\ReviewBundle\SyliusReviewBundle -> SyliusReviewBundle
Sonata\BlockBundle\SonataBlockBundle -> SonataBlockBundle
If you look at the class you use to add a bundle to your registered bundles you can get the bundle name from that.
So, for example (taken from the Sonata Block Bundle docs)..
public function registerBundles()
{
return array(
// Dependency (check that you don't already have this line)
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
// Vendor specifics bundles
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
);
}
would be KnpMenuBundle
, SonataCoreBundle
and SonataBlockBundle
.
You cand find the bundle name in the main php Class of any bundle, it is called like the bundle, in this case in /vendor/friendofsymfony/user-bundle/FOSUserBundle
Additionally you can just execute the console command config:dump-reference
to list the available bundle names.
3.x php bin/console config:dump-reference
~2.4 php app/console config:dump-reference
Outputs:
Available registered bundles with their extension alias if available:
+------------------------------+--------------------------+
| Bundle name | Extension alias |
+------------------------------+--------------------------+
| AppBundle | |
| AsseticBundle | assetic |
| DebugBundle | debug |
| DoctrineBundle | doctrine |
| DoctrineMongoDBBundle | doctrine_mongodb |
| FrameworkBundle | framework |
| KnpMenuBundle | knp_menu |
| KnpPaginatorBundle | knp_paginator |
| LiipImagineBundle | liip_imagine |
| MewesKTwigExcelBundle | mewes_k_twig_excel |
| MonologBundle | monolog |
| SecurityBundle | security |
| SensioDistributionBundle | sensio_distribution |
| SensioFrameworkExtraBundle | sensio_framework_extra |
| SensioGeneratorBundle | |
| StofDoctrineExtensionsBundle | stof_doctrine_extensions |
| SwiftmailerBundle | swiftmailer |
| TwigBundle | twig |
| UserBundle | |
| VichUploaderBundle | vich_uploader |
| WebProfilerBundle | web_profiler |
+------------------------------+--------------------------+