At the section Upgrading Existing Applications to Flex, the Symfony 4 documentation states:
- Move the original source code from
src/{App,...}Bundle/
tosrc/
and update the namespaces of every PHP file to beApp\...
(advanced IDEs can do this automatically).
The first part "Move the original source code from src/{App,...}Bundle/
" is clear. We can understand a directory structure like this:
sf3-project/
├── src/
├── AppBundle/
├── Controller/
├── MyFirstController.php
└── MySecondController.php
└── ...
└── ApiBundle/
├── Controller/
├── MyFirstController.php
└── MySecondController.php
└── ...
However, the second part "to src/
and update the namespaces of every PHP file to be App\...
" is unclear to me, especially about the suggested structure.
As I understood, it suggests to copy the content of each Controller/
directory in one directory. If so, how to deal with controllers that have the same name? Should we add subdirectories with the prefix of the former bundle as name?
The symfony demo project seems to suggest it, because of the Admin/
directory under Controller/
.
How should we upgrade the previous directory structure to the following?
sf4-project/
├── src/
├── Controller/
│ └── ...
├── ...
└── Kernel.php
We can notice this sf4-project example follows a package by layer structure, like in the documentation. I'm also wondering if we can easily use a package by feature structure.
So, what are the suggested ways with Symfony 4 for both package by layer and package by feature structures ?