8000 Serializer and Validator mappings don't use Bundle#getPath() · Issue #18563 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Serializer and Validator mappings don't use Bundle#getPath() #18563
Closed
@wouterj

Description

@wouterj

Description

The bundle class has a getPath() method, allowing you to override the path of the bundle. However, inside the FrameworkExtension, $reflection->getFileName() is used to get the path to the bundle. This means that getPath() is ignored.

Use-case

In my case, my bundle directory structure looks like:

MyBundle/
  src/
    MyBundle.php
    ...
  Resources/
    config/
      serializer.yml
      validator.yml

In the MyBundle class, I override getPath() to return MyBundle/. This way, I would expect the serializer and validator configuration to be loaded. However, since they use reflection they're looking for MyBundle/src/Resources/config/serializer.yml.

Possible Solution

The auto-discovery of config files should be moved to a compiler pass. These have access to the bundle class instance (instead of FQCN) and can call ->getPath() on this instance instead of simulating the default behaviour of this method.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0