8000 [RFC][Validator] Configure XML or Yaml mappings for Validator · Issue #15655 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[RFC][Validator] Configure XML or Yaml mappings for Validator #15655

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
sroze opened this issue Aug 30, 2015 · 1 comment
Closed

[RFC][Validator] Configure XML or Yaml mappings for Validator #15655

sroze opened this issue Aug 30, 2015 · 1 comment

Comments

@sroze
Copy link
Contributor
sroze commented Aug 30, 2015

Right now, to use the validator component within a Symfony application, we need to configure the validation constraints as annotations or in XML or Yaml files in the Resources/config/validation directory or in a big Resources/config/validation.[x|y]ml file in a bundle directory.

In order to be able to re-use validation across libraries or just make the validation living where the user wants, I propose to introduce a validation mapping configuration in the framework configuration:

framework:
    validation:
        mappings:
            - %kernel.root_dir%/../src/Acme/Demo/Resources/validation
            - %kernel.root_dir%/../src/Acme/Library/Resources/validation.yml

The mapping values can be either a directory or a file. If it's a file, will be added as YML or XML based on the extension. If it's a directory, then using the finder we will be able to locate all the *.[x|y]ml files.

Before PR this feature, what do you think about it ?

@aitboudad
Copy link
Contributor

see #13878

@fabpot fabpot closed this as completed Jan 23, 2017
fabpot added a commit that referenced this issue Jan 23, 2017
…alidation secti… (davewwww)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle] add "mapping" configuration key at validation secti…

| Q | A |
| --- | --- |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #15655 |
| License | MIT |
| Doc PR | symfony/symfony-docs#7407 |

This feature allows you, to define additional validation files or directories which are not in the 'Bundle*/Resources/config/' directory.

``` yaml
#config.yml
framework:
  validation:
    mapping:
      paths:
        - "path/to/file/validation.yml"
        - "path/to/file/validation.xml"
        - "path/to/another/directory"
```

Commits
-------

d696cfb [FrameworkBundle] Configurable paths for validation files
60d7d43 fix merge
61475b5 Merge branch '3.2'
ba41e70 Merge branch '3.1' into 3.2
4268aba Merge branch '2.8' into 3.1
3faf655 Merge branch '2.7' into 2.8
e95fc09 fix getMock usage
482828c fix merge
ed5eb6d bug #21372 [DependencyInjection] Fixed variadic method parameter in autowired classes (brainexe)
a7f63de [DependencyInjection] Fixed variadic method parameter in autowired classes
9ef4271 minor #21371 [Validator] update German translation (xabbuh)
f920e61 update German translation
41c72ab minor #21335 [Validator] Improved error message for missing upload_tmp_dir (Breuls)
afbf227 [Validator] Improved error message for missing upload_tmp_dir
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