Flex: Make the path of `App\` namespace configurable

Created on 27 Oct 2017  路  3Comments  路  Source: symfony/flex

Hello.

I found this closed issue: https://github.com/symfony/flex/issues/138
And I want to wide the scope of this and suggest to configure the path to the App\ namespace configurable, or in other words, the directory that is under control of flex and its manifests.

As we already configure the path to the App\ namespace inside the composer.json it would be nice if that could also be the configuration of "Here Flex, this is your directory. If you copy things from manifests, place them there."

The use case could be, to have the possibility to separate business logic from framework integration inside the src directory.

Most helpful comment

@Pierstoval The issue is that when making these adjustments in the composer.json file, they will not be taken into account insides recipes. For example, the DoctrineBundle recipe uses the hardcoded src path for its mapping configuration: https://github.com/symfony/recipes/blob/master/doctrine/doctrine-bundle/1.6/config/packages/doctrine.yaml#L12

A possible approach @kolibri and me discussed last week was to be able to refer to %SRC_DIR and so inside files of your recipe that will be copied by Flex.

All 3 comments

If you're just talking about the App namespace, I think this will never be possible. The issue #138 you linked has enough discussions about this.

For src/ you can change it by customizing the src-dir option in your composer-json:

{
    "extra": {
        "src-dir": "lib/"
    }
}

This will not change the namespace though.

If you want to change the namespace, change it for everything that's installed by Flex manually (entities, etc.), and change the psr-4 rules in your composer.json file.

@Pierstoval The issue is that when making these adjustments in the composer.json file, they will not be taken into account insides recipes. For example, the DoctrineBundle recipe uses the hardcoded src path for its mapping configuration: https://github.com/symfony/recipes/blob/master/doctrine/doctrine-bundle/1.6/config/packages/doctrine.yaml#L12

A possible approach @kolibri and me discussed last week was to be able to refer to %SRC_DIR and so inside files of your recipe that will be copied by Flex.

Closing this issue as I'm not interested in supporting this use case. If somebody wants to make it work, I would happily review pull requests.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

javiereguiluz picture javiereguiluz  路  6Comments

weaverryan picture weaverryan  路  3Comments

eb22fbb4 picture eb22fbb4  路  8Comments

fabpot picture fabpot  路  7Comments

emulienfou picture emulienfou  路  4Comments