dev-master
9999999-dev https://github.com/gfreeau/GfreeauCustomValidationPathBundleThis Symfony2 bundle provides a method for adding custom validation directories
MIT
The Requires
by Greg Freeman
validation symfony2 custom directory path
This Symfony2 bundle provides a method for adding custom validation directories
This symfony2 bundle is still under development, it allows you to define custom directories for storing validation files., (*1)
This is useful if you store entities and models outside of bundles. Doctrine and JMSSerializer already allow this, but by default symfony only loads xml and yml validation configuration from within bundles., (*2)
Here is an example project structure where our non-framework code does not exist in bundles:, (*3)
src Vendor Bundle AcmeBlogBundle Service Entity Resources config doctrine serializer validation
Here is an example config:, (*4)
gfreeau_custom_validation_path: directories: - path: %kernel.root_dir%/../src/Vendor/Resources/config/validation type: xml recursive: true - path: %kernel.root_dir%/../src/Vendor/Resources/config/validation type: yml recursive: false
You will know if your validation files have been included by running:, (*5)
./app/console container:debug --format=json --parameters
look for the key validator.mapping.loader.xml_files_loader.mapping_files
or validator.mapping.loader.yml_files_loader.mapping_files
, (*6)
Here is the example config for orm and serializer to go along with custom validation directories:, (*7)
doctrine: orm: auto_mapping: true mappings: mymodel: type: xml dir: %kernel.root_dir%/../src/Vendor/Resources/config/doctrine prefix: Vendor\Entity alias: VendorEntity is_bundle: false jms_serializer: metadata: directories: myvendor: namespace_prefix: "Vendor\\" path: %kernel.root_dir%/../src/Vendor/Resources/config/serializer
This Symfony2 bundle provides a method for adding custom validation directories
MIT
validation symfony2 custom directory path