Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Proposal] Allow to override the recipes in project #185

Copy link
Copy link
Closed
@francoispluchino

Description

@francoispluchino
Issue body actions

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 not MyCompany\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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.