-
-
Notifications
You must be signed in to change notification settings - Fork 195
[Proposal] Allow to override the recipes in project #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It all depends on what you want to achieve. When migrating a project to Flex, almost everytime you'll face the issue of the namespace changes in I'm not sure about the maintainers, but I think it would be too overkill/problematic to make Flex aware of namespaces, because our PHP files would have to be modified when generated, and I personally would never like to have to handle this manually, because there are too many possible edge cases and security issues.
All of these are informations available in the recipe, I don't see why it's a problem. In a personal project I'm migrating to Flex, I was using the Standard Edition since 2.3, and migrating to flex was a big work, but for namespaces, I just copy/pasted the sources in About half a day to do it. And no namespace nor script issue. |
Just like you, my biggest project has also been migrated from version 2.0 until last month with Flex. The migration was very fast, respecting the best practices (except for the Question of the namespace: As I said before, simply changing the namespace of autoload (
On the other hand, what is disturbing is having a blocked namespace on By simply changing the I understand that you do not want to complexify Flex, but is not it possible to do as you did with the SensioGeneratorBundle. That is to say, to be able to put 8000 variables in the PHP file which consequently becomes a template? For example, for <?php
namespace App;
// code becomes: <?php
namespace {{ app_namespace }};
// code And Flex replace the variable during the copy. In this way you keep backward compatibility for current recipes, and for recipes that taking into account the variable, this capacity is automatically used. It is not necessary to use Twig like the made the SensioGeneratorBundle, because a simple regex is enough for variables.
With my proposal, and a job you've already done on SensioGeneratorBundle, this would be automatic, so I do not see how it's overkill/problematic to make Flex aware of namespaces.
I need you to develop this part because I do not see how this is problematic. SensioGeneratorBundle is not secure ?? But in the current case, what is the best practice for Flex with the namespace Is it better to create a 2nd folder Or, simply changing the Or, is it better to extract all components and bundles to another main repository (still with cutting in each repository in read-only)?
Question of the recipe configurations: Currently, the problem of domain names is not an emergency, it is just not DX for big projects. Regarding the configuration of recipes:
The problem, and I explained it with a concrete case on the composer's scripts. Very well, yesternight you deleted the support of Makefile here, here and here in the Symfony FrameworkBundle recipe. So now, Flex does not attempt to add to each reinstall the Indeed, with all the changes made, leave the possibility to the project modified recipes is no longer really useful. However, Flex interactively asks if we want to install the recipe during the first installation. For the first time, it's developer friendly, but if you answered no, the next time you reinstall the project, Flex will ask again the question. Is it not possible to save the answers for each package in the |
By answering, I forgot the part of the environment variables. Currently, it is impossible to change the default values of environment variables because Flex overwrites each time the entire section of each package. For example, for Doctrine ORM, it is configured on Mysql:
So if you want to set another default value to set PostgreSQL, this is not possible. Do you have anything to fix this problem? |
The "overwrite" part of flex exists only when doing a For the interaction part about asking questions to the user, @fabpot expressed many times that he didn't want Flex to interact with the user for better DX, the only "accepted" interaction now is the fact that contrib recipes need user approval if you don't set it up in your Next, about namespaces, which seems to be your biggest need: The What is the "app" namespace? The default And even for your app, it's a monolithic repo that creates a subsplit of every repo in read-only packages, it's great, but then your app is one specific case. The "default" for everyone is to use this Default ways of doing things is about recommendations, and bundleless apps have been a recommendation since a few years now (I think it has started at the same time the official Symfony installer release, IIRC). I don't see why we should add too much complexity over simple already-configurable namespaces when we recommend user to use the default setup and customize it. |
Since I notice annoyance on your part, and some confusion between my comments and your reactions, therefore, I suppose my English should not be very clear. In this case, I apologize, and you will understand that I try to be the most understandable and respectful when I express myself. However, my English is not equivalent to my French. So I'll try to be clearer :-).
I understand that there is a confusion between us, because I had an old version of Flex, and the behaviors explained are no longer effective with the
Flex will copy the recipe files into To be clearer, my current configuration of autoload is: {
"autoload": {
"psr-4": {
"App\\": "src/App/",
"MyCompany\\": "src/MyCompany/"
}
},
} By responding to you and noticing the difference in behavior with the latest version, I understand your astonishment about the variable in the recipe to change the namespace to the installation, and my proposal is useless if Flex is able to take into account the proper folder for the So, is it possible to take into account the folder where is the Also, do not consider my comment on the custom values overwriting environment variables in
As mentioned above, I use the
I was just taking your use case. I noticed that it was only a proposal :-).
Sorry, I follow the conversations, but I have not read any information about it, so thank you for the info, and at the same time, I agree on this point. Conclusion: Hopefully you understand that I appreciate and respect the work of the entire Symfony team and the contributors of which I am a part, and that I am only asking questions or proposing solutions to concrete cases. But for this use case, wasn't really useful, given that this was not the behavior of the latest version of Flex. I am aware that there was confusion, and to sum up, instead of taking my original proposal that is out of date, is it possible to take into account the namespace folder
Thank you for your help. |
I have looked at the Flex code in more detail, and there are options that are not used, including |
The option |
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 tosrc
,template
,translations
, and the overwriting of the configurations by the recipes during the installation (not the case for the update), such ascomposer-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 namespaceApp
(ok, it can be modified). So, to transfer a Symfony 3.x project to Symfony 4.0, the basic idea is to move thesrc
folder tosrc/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 foldersrc2
with a psr-4"App\\": "src/App/"
and"MyCompany\\": "src2/MyCompany/"
is not the most relevant. We can also change the autoload to replaceApp\\
byMyCompany\\
, but we will also have theComponent
andBundle
folders withKernel.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 themake
command), Flex will add the"make cache-warmup": "script"
command each time. Same for the copy of the files likeMakefile
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?
The text was updated successfully, but these errors were encountered: