2017 © Pedro Peláez
 

symfony-bundle custom-validation-path-bundle

This Symfony2 bundle provides a method for adding custom validation directories

image

gfreeau/custom-validation-path-bundle

This Symfony2 bundle provides a method for adding custom validation directories

  • Tuesday, October 4, 2016
  • by gfreeau
  • Repository
  • 2 Watchers
  • 1 Stars
  • 178 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

GfreeauCustomValidationPathBundle

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

The Versions

04/10 2016

dev-master

9999999-dev https://github.com/gfreeau/GfreeauCustomValidationPathBundle

This Symfony2 bundle provides a method for adding custom validation directories

  Sources   Download

MIT

The Requires

 

validation symfony2 custom directory path