mathielen / ImportEngineBundle

A generic import (and export) -engine that provides easy to use yet powerful features
15 stars 3 forks source link

Bug - validation - email #12

Open thim81 opened 8 years ago

thim81 commented 8 years ago

When trying the validation configuration

 #validate imported data
            validation:
                source:                     #add constraints to source fields
                    header1: email
                    header2: notempty
                target: ~                   #activate validation against generated object from object-factory (via annotations, xml)
                                            #or supply list of constraints like in source

The cmd outputs the following error:

 [Symfony\Component\Debug\Exception\ClassNotFoundException]  
  Attempted to load class "email" from the global namespace.  
  Did you forget a "use" statement?           

Part of the stack trace

    1.6576   33232264   7. Mathielen\ImportEngineBundle\Command\ImportCommand->execute() /Users/tim/Sites/webapp/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:257
    1.6577   33233448   8. Mathielen\ImportEngineBundle\Command\ImportCommand->import() /Users/tim/Sites/webapp/vendor/mathielen/import-engine-bundle/Mathielen/ImportEngineBundle/Command/ImportCommand.php:66
    1.6590   33388040   9. Symfony\Component\DependencyInjection\Container->get() /Users/tim/Sites/webapp/vendor/mathielen/import-engine-bundle/Mathielen/ImportEngineBundle/Command/ImportCommand.php:92
thim81 commented 8 years ago

Same issue for "notempty"

Attempted to load class "notempty" from the global namespace.

Any idea what I'm missing?

thim81 commented 8 years ago

Markus,

Can you tell me if I need to include a class for the validation?

mathielen commented 8 years ago

Gimme a sec, I look into it

mathielen commented 8 years ago

Yea, its bug...

mathielen commented 8 years ago

Ok, so for now I have fixed the bundle to look for a service-reference named after the validation's name. That means you have to add a service of a class that extends \Symfony\Component\Validator\Constraint and named after the validation-type (for example: email).

I check if there is a more convenient way to reuse the logic of symfony-validator to automatically create constraints by name.

thim81 commented 8 years ago

Should I pull the master? Or you prefer to keep using the releases?

mathielen commented 8 years ago

For now, please use dev-master.