Symfony 4 : How to customize non-standard directories
Symfony 4 is configured to read orm entities , routing annotations and twig file only from the standard directory .
In this tutorial , I will show you how to set up your project to cope with non-standard directories
Supposing we have a new directory called “new_folder” which contains entities , controllers and twig files .
1️⃣ Controller annotations :
If you want routing be provided by annotations , add the path to your controller to annotation.yaml file
2️⃣ ORM Entity :
Register the new directory of orm entities under doctrine.orm.mappings :
If your folder is a bundle folder , turn “is_bundle” attribute to “true”
3️⃣ templates :
The alias is optional .
4️⃣ Bundles :
Ok .. It’s not recommended to create bundles in Symfony 4
But if you have to do ..
Create a php file with the name of the bundle
class someBundle extends Bundle
Activate your bundle :
App\new_folder\someBundle::class => ['all' => true],
I’m Mouna , developer from Tunisia
This article is written in collaboration with Mariem Torjmen
Feel free to put comments , questions or suggestions below ❤