Skip to content
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

[Form] [Validator] Added IBAN validator #6677

Merged
merged 1 commit into from
Apr 20, 2013
Merged

[Form] [Validator] Added IBAN validator #6677

merged 1 commit into from
Apr 20, 2013

Conversation

sprain
Copy link
Contributor

@sprain sprain commented Jan 10, 2013

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
License of the code: MIT

Validation for International Bank Account Numbers
http://en.wikipedia.org/wiki/International_Bank_Account_Number

I don't know if the community likes new validators. I have been using this in many projects and would love to see it integrated directly with Symfony.

@stloyd
Copy link
Contributor

stloyd commented Jan 10, 2013

First of... please fix Coding Standards to match Symfony2. =)

*/
public function validate($value, Constraint $constraint)
{

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing empty string validation skip:

if (null === $value || '' === $value) {
    return;
}

@sprain
Copy link
Contributor Author

sprain commented Jan 10, 2013

Thanks for your feedback. I updated the code and hope things are ok now.

}

$teststring = preg_replace('/\s+/', '', $value);
$teststring = substr($teststring,4)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space after the comma

@alexandresalome
Copy link

In french (fr_FR) it's "Le numéro IBAN saisi n'est pas valide (International Bank Account Number)."

@sprain
Copy link
Contributor Author

sprain commented Jan 11, 2013

Updated!
Any ideas why PHPStorm keeps messing with my indentation levels after saving a file?

@stloyd
Copy link
Contributor

stloyd commented Jan 11, 2013

@sprain You can use in PHPStrom: Edit -> Convert Indents -> To Spaces if it won't help you should change settings: File -> Settings -> Code Style -> General (or PHP) and turn of "Use tab character".

@webmozart
Copy link
Contributor

Thank you for this implementation! Could you please add tests for the null and empty string cases? (see the other validator tests)

Also, as was said, please fix the indentation.

@sprain
Copy link
Contributor Author

sprain commented Feb 21, 2013

Thanks for the feedback.
Will do when I am back from vacation, in 10 days or so.

@@ -222,6 +222,10 @@
<source>Unsupported card type or invalid card number.</source>
<target>Nicht unterstützer Kartentyp oder ungültige Kartennummer.</target>
</trans-unit>
<trans-unit id="59">
<source>This is not a valid International Bank Account Number (IBAN).</source>
<target>Dieser Wert ist keine gültige IBAN-Kontonummer.</target>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong indention. Maybe tabs vs spaces

@fabpot
Copy link
Member

fabpot commented Mar 26, 2013

@sprain What's the status of this PR? Can you take the comments into account?

@sprain
Copy link
Contributor Author

sprain commented Mar 26, 2013

Thanks for the reminder! I just pushed an update. Hope things are fine now.

@AAtticus
Copy link

Exactly what I needed.
Now waiting for merge!

@sprain
Copy link
Contributor Author

sprain commented Apr 12, 2013

/**
* @Annotation
*
* @api
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove @api as it will be decided later

@kimausloos
Copy link

Hi, any updates on this one? Adding these would be quite usefull for a couple of projects... Thanks!

@AAtticus
Copy link

@kimausloos You can use the SprainValidator has a seperate extension until then

https://github.com/sprain/SprainValidatorBundle

@kimausloos
Copy link

@AAtticus Thanks, that's the plan but it would be nice if I wouldn't have to add an extra bundle as they impact speed and memory usage :)

Validation for International Bank Account Numbers
fabpot added a commit that referenced this pull request Apr 20, 2013
This PR was merged into the master branch.

Discussion
----------

[Form] [Validator] Added IBAN validator

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
License of the code: MIT

Validation for International Bank Account Numbers
http://en.wikipedia.org/wiki/International_Bank_Account_Number

I don't know if the community likes new validators. I have been using this in many projects and would love to see it integrated directly with Symfony.

Commits
-------

c8906f4 [Validator] Added IBAN validator
@fabpot fabpot merged commit c8906f4 into symfony:master Apr 20, 2013
@sprain sprain deleted the validator-iban branch April 20, 2013 16:08
@rvanlaak
Copy link
Contributor

rvanlaak commented Oct 6, 2013

According to the news items on the following page it seems that there have been a lot of changes due to country specific differences.

https://code.google.com/p/php-iban/

Should Symfony's Iban Validator be adjusted to that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.