10000 Cannot use hyphen in symfony asset package name · Issue #28122 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Cannot use hyphen in symfony asset package name #28122

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

Closed
damaya opened this issue Aug 2, 2018 · 4 comments
Closed

Cannot use hyphen in symfony asset package name #28122

damaya opened this issue Aug 2, 2018 · 4 comments

Comments

@damaya
Copy link
Contributor
damaya commented Aug 2, 2018

Symfony version(s) affected: 3.4.14

Description
When using hyphen in symfony asset package name, the following error is shown:

"An exception has been thrown during the rendering of a template ("There is no "frontend-app" asset package.")."

How to reproduce

framework:
        packages:
            frontend-app:
                base_path: '/'

NOTE: in this example, when removing the hyphen or replacing hyphen with underscore, it works as expected, for example:

framework:
        packages:
            frontendapp:
                base_path: '/'

or this

framework:
        packages:
            frontend_app:
                base_path: '/'
@dmaicher
Copy link
Contributor
dmaicher commented Aug 3, 2018

I guess the keys are normalized when processing the config:

normalizeKeys(false)
If called (with false), keys with dashes are not normalized to underscores. It is recommended to use this with prototype nodes where the user will define a key-value map, to avoid an unnecessary transformation.

http://symfony.com/doc/current/components/config/definition.html#array-node-options

@damaya can you check if adding ->normalizeKeys(false) helps here?

https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php#L634

@damaya
Copy link
Contributor Author
damaya commented Aug 3, 2018

Hi @dmaicher thanks for your feedback about this, yes, this is clear now, i tested wit the
->arrayNode('packages')->normalizeKeys(false) and it worked, i suppose this would't require any update for the array mappings yml configs.
Thanks so much.

@dmaicher
Copy link
Contributor
dmaicher commented Aug 3, 2018

Up for creating a PR with this fix? :) I cannot think of any reason not to do it that way.

damaya added a commit to damaya/symfony that referenced this issue Aug 3, 2018
Support for using hyphens on yaml config for packages names, according to issue symfony#28122 (comment)
damaya added a commit to damaya/symfony that referenced this issue Aug 3, 2018
Support for using hyphens on yaml config for packages names, according to issue symfony#28122 (comment)
damaya added a commit to damaya/symfony that referenced this issue Oct 10, 2018
| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes (Manual tests only)
| Fixed tickets | symfony#28122
| License       | MIT
| Doc PR        | n/a

According to issue symfony/symfony-docs#10442, we tested in a demo bundle, for example in src/AppBundle/Resources/config/config.yml a package using hyphens: app-client-frontend, and withouth the patch it fails because the package is not recognized. With the patch, it works as expected.
```
framework:
    assets:
        packages:
            app-client-frontend:
                version: "%env(FRONTEND_VERSION)%"
                version_format: '%%2$s/dist/%%1$s'
                base_urls:
                  - "%env(FRONTEND_URL)%"
```
XuruDragon pushed a commit to XuruDragon/symfony that referenced this issue Jan 28, 2019
Support for using hyphens on yaml config for packages names, according to issue symfony#28122 (comment)
XuruDragon pushed a commit to XuruDragon/symfony that referenced this issue Jan 28, 2019
| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes (Manual tests only)
| Fixed tickets | symfony#28122
| License       | MIT
| Doc PR        | n/a

According to issue symfony/symfony-docs#10442, we tested in a demo bundle, for example in src/AppBundle/Resources/config/config.yml a package using hyphens: app-client-frontend, and withouth the patch it fails because the package is not recognized. With the patch, it works as expected.
```
framework:
    assets:
        packages:
            app-client-frontend:
                version: "%env(FRONTEND_VERSION)%"
                version_format: '%%2$s/dist/%%1$s'
                base_urls:
                  - "%env(FRONTEND_URL)%"
```
XuruDragon pushed a commit to XuruDragon/symfony that referenced this issue Jan 28, 2019
| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes (Manual tests only)
| Fixed tickets | symfony#28122
| License       | MIT
| Doc PR        | n/a

According to issue symfony/symfony-docs#10442, we tested in a demo bundle, for example in src/AppBundle/Resources/config/config.yml a package using hyphens: app-client-frontend, and withouth the patch it fails because the package is not recognized. With the patch, it works as expected.
```
framework:
    assets:
        packages:
            app-client-frontend:
                version: "%env(FRONTEND_VERSION)%"
                version_format: '%%2$s/dist/%%1$s'
                base_urls:
                  - "%env(FRONTEND_URL)%"
```
XuruDragon pushed a commit to XuruDragon/symfony that referenced this issue Jan 28, 2019
…rationTest also adding the corresponding entry in the changelog
XuruDragon pushed a commit to XuruDragon/symfony that referenced this issue Jan 28, 2019
| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes (Manual tests only)
| Fixed tickets | symfony#28122
| License       | MIT
| Doc PR        | n/a

According to issue symfony/symfony-docs#10442, we tested in a demo bundle, for example in src/AppBundle/Resources/config/config.yml a package using hyphens: app-client-frontend, and withouth the patch it fails because the package is not recognized. With the patch, it works as expected.
```
framework:
    assets:
        packages:
            app-client-frontend:
                version: "%env(FRONTEND_VERSION)%"
                version_format: '%%2$s/dist/%%1$s'
                base_urls:
                  - "%env(FRONTEND_URL)%"
```
XuruDragon pushed a commit to XuruDragon/symfony that referenced this issue Jan 28, 2019
| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes (Manual tests only)
| Fixed tickets | symfony#28122
| License       | MIT
| Doc PR        | n/a

According to issue symfony/symfony-docs#10442, we tested in a demo bundle, for example in src/AppBundle/Resources/config/config.yml a package using hyphens: app-client-frontend, and withouth the patch it fails because the package is not recognized. With the patch, it works as expected.
```
framework:
    assets:
        packages:
            app-client-frontend:
                version: "%env(FRONTEND_VERSION)%"
                version_format: '%%2$s/dist/%%1$s'
                base_urls:
                  - "%env(FRONTEND_URL)%"
```
XuruDragon pushed a commit to XuruDragon/symfony that referenced this issue Jan 28, 2019
| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes (Manual tests only)
| Fixed tickets | symfony#28122
| License       | MIT
| Doc PR        | n/a

According to issue symfony/symfony-docs#10442, we tested in a demo bundle, for example in src/AppBundle/Resources/config/config.yml a package using hyphens: app-client-frontend, and withouth the patch it fails because the package is not recognized. With the patch, it works as expected.
```
framework:
    assets:
        packages:
            app-client-frontend:
                version: "%env(FRONTEND_VERSION)%"
                version_format: '%%2$s/dist/%%1$s'
                base_urls:
                  - "%env(FRONTEND_URL)%"
```
XuruDragon pushed a commit to XuruDragon/symfony that referenced this issue Jan 29, 2019
| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes (Manual tests only)
| Fixed tickets | symfony#28122
| License       | MIT
| Doc PR        | n/a

According to issue symfony/symfony-docs#10442, we tested in a demo bundle, for example in src/AppBundle/Resources/config/config.yml a package using hyphens: app-client-frontend, and withouth the patch it fails because the package is not recognized. With the patch, it works as expected.
```
framework:
    assets:
        packages:
            app-client-frontend:
                version: "%env(FRONTEND_VERSION)%"
                version_format: '%%2$s/dist/%%1$s'
                base_urls:
                  - "%env(FRONTEND_URL)%"
```
@javiereguiluz
Copy link
Member

Closing as fixed by #30007.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0