Description
In the proposal #179, @Pierstoval proposes a command to reset the recipes, and explains these motivations. However, in the "Upgrade example" section, there are 2 other problems to consider: that of moving the app
folder to src
, template
, translations
, and the overwriting of the configurations by the recipes during the installation (not the case for the update), such as composer-scripts
.
Before Symfony 4.0, the src
folder allowed to put its code with a tree of type:
src/MyCompany/Component/*
src/MyCompany/Bundle/*
and the app
folder was used to set the config, templates, translations, etc ... You can take the Sylius project in example.
However, with the new best practices, the src
folder is used to put only the code of the application with the namespace App
(ok, it can be modified). So, to transfer a Symfony 3.x project to Symfony 4.0, the basic idea is to move the src
folder to src/App
and modify the autoload. This works fine when the vendors are already installed, however when you perform a new installation, Flex copies all the files from the recipe.
The idea of creating a src
folder and another folder src2
with a psr-4 "App\\": "src/App/"
and "MyCompany\\": "src2/MyCompany/"
is not the most relevant. We can also change the autoload to replace App\\
by MyCompany\\
, but we will also have the Component
and Bundle
folders with Kernel.php
, Entity
, Controller
, Repository
, Migrations
, etc ... which is also not pleasant.
And the idea of updating the autoload "App\\": "src/"
by "MyCompany\\": "src/"
is not relevant either, because the class namespace will be. it can be done, but it would be more pleasant to have these 3 namespaces:
MyCompany\App\Entity\Foo
(and notMyCompany\Entity\Foo
)MyCompany\Component\Bar\Boo
MyCompany\Bundle\BazBundle\MyCompanyBazBundle
that to say, a tree that looks like this:
src/MyCompany/App/Kernel.php
src/MyCompany/App/Entity/Foo.php
src/MyCompany/App/Repositories/FooRepository.php
src/MyCompany/Component/Bar/Boo.php
src/MyCompany/Bundle/BazBundle/MyCompanyBazBundle.php
In addition, if you change the scripts.auto-scripts
section to remove the "make warmup" : "script"
command and replace it with a "cache: warmup": "symfony-cmd"
(because your prod environment does not have the make
command), Flex will add the "make cache-warmup": "script"
command each time. Same for the copy of the files like Makefile
that are copied each time, if you delete it.
So, what solution is there for these 2 situations, or is it simply possible to overload the configuration of the recipes in the project?
Note:
In this case, proposal #173 and the PR #174 will easily solve the problem. But a native system to override the configuration of the recipes in the project would be much more practical than creating a plugin for Composer and Flex.