FriendsOfSymfony / friendsofsymfony.github.io

Description of what FriendsOfSymfony (aka FoS) is about.
http://friendsofsymfony.github.io
32 stars 4 forks source link

[RFC] Adding a FOSValidationExtraBundle #21

Closed hhamon closed 5 years ago

hhamon commented 13 years ago

Hi all,

I was wondering if it would be a good idea to add a bundle containing extra validation assertions like the followings:

* IBAN number
* European VAT number
* (French & other countries) Bank Account number
* (French & other countries) Social Security number
* (French & other countries) Zip Code number
* ...

I have already written validators and unit tests for IBAN, VAT & RIB (= french bank account number).

Do you think it's a good idea to group basic validators like those in the same bundle?

Cheers,

lsmith77 commented 13 years ago

so far the only "custom" validator i needed was for handling unique usernames in FOSUserBundle, but I can totally see myself needing the above and its probably good not to overburden the Validation component with all too many validators.

I also imagine that the vespolina project could have a use for these .. @iampersistent, @merk .. ?

merk commented 13 years ago

Sounds like a good idea to me, though should it just be limited to validator components? What about custom form types?

stof commented 13 years ago

@merk This is a different topic and should IMO stay a different bundle (which already exists BTW)

merk commented 13 years ago

I dont know..

If we're talking about providing FOS validators as part of a bundle, i dont see why things of 'similar' ilk cant be included like form extensions and other little helpers, should they arise?

Doesnt matter if they're all broken out though - its just a thought.

schmittjoh commented 13 years ago

I would prefer to add useful validators to the component instead of a bundle.

lsmith77 commented 13 years ago

I guess my concern is with the release cycle of the core component which is currently bound to Symfony2 itself.

hhamon commented 13 years ago

@schmittjoh we can't add them to the core validation component as the goal is to store validation rules depending on the country. It's too specific that's why we have to move to a bundle.

henrikbjorn commented 13 years ago

There is already a bundle for Form stuff . simplethings/SimpleThingsFormExtraBundle which theese would fit nicely. Cant see the idea of creating this as a FOS bundle just because it can be done.

lsmith77 commented 13 years ago

but that bundle from a quick skim doesnt have validators yet. plus form and validation are even a separate component in core.

schmittjoh commented 13 years ago

@hhamon, really? I mean we have a money validator which also has such rules built-in. A postal code validator seems to be quite similar to me.

The release cycle is a different story, but we could always make a bundle which backports these validators for older releases.

hhamon commented 13 years ago

@schmittjoh good catch, I forgot the money validator. We should ask @fabpot about the release process. As we want to add new validators, they can figure in next releases such as 2.1, 2.2...

lsmith77 commented 13 years ago

To me the money validator is likely in core as a show case rather than as an indicator that its a good idea to place lots of high level validators into the component itself. what i do realize just now is that a Bundle might not be the right approach for the validators (same goes for form types), since it would make them Symfony2 "only" to some extend.

Imho the best would be the creation of a library for form-types/validators and then a single Bundle that exposes them as needed in Symfony2.

lsmith77 commented 13 years ago

guess @bschussek is living the good life in spain, but maybe he wants to still comment?

henrikbjorn commented 13 years ago

@lsmith77 then we could just add them to the bundle not a big deal really :)

lsmith77 commented 13 years ago

lets warm this topic up again https://twitter.com/#!/gimler/statuses/132033325194952704

cc @gimler

webmozart commented 13 years ago

I think this is a good idea. As for the non-Symfony2 people - nothing prevents them from adding the bundle to their code too, as long as it is PSR-0 compliant.

Should we ever find out that we want these features in the core, we can still move them there.

gimler commented 13 years ago

i would prefer the way like twig was going twig-extensions so we should create a repository for the component

form-extensions validator-extensions

lsmith77 commented 13 years ago

in this context i would also like to bring up https://github.com/rdohms/DMS-filter (still in its infancy .. but imho filtering should be an optional step before validation)

merk commented 12 years ago

Ping, I'd like to see some kind of extended validator bundle that supplies additional validator rules. Did we ever determine if @fabpot wanted to have these rules in core?

dbu commented 5 years ago

i assume that this is not relevant anymore. if it is, please reopen