cakephp / localized

I18n and L10n related CakePHP code
Other
213 stars 179 forks source link

Implemented personId for EsValidation #121

Closed elboletaire closed 8 years ago

elboletaire commented 8 years ago

As said in #117 we have more than one personId type. For that reason I've created three methods (a part from the personId itself):

For this reason, I've implemented personId to check all them by default, but you can specify which types you wanna check with its second parameter:

EsValidation::personId('whatever'); // checks all types.
EsValidation::personId('whatever', ['dni']); // only checks dni type.
EsValidation::dni('whatever'); // same as above, but using its proper method.
EsValidation::personId('whatever', ['dni', 'nif']); // only checks dni and nif types.
elboletaire commented 8 years ago

I'm currently fixing the constant issue. At first I thought it was due to the array shortcuts but later I've seen it's due to the usage of the constant as an array, which is not supported until php 5.6.

elboletaire commented 8 years ago

I forgot that there's an interface which specifies how the personId method should be. So, I've removed the optional param and now personId checks for any valid NIF type.

elboletaire commented 8 years ago

No comments about this @dereuromark @antograssiot ??

dereuromark commented 8 years ago

Looks good apart from my comments about more strictness.

elboletaire commented 8 years ago

Thanks for the revision @dereuromark. I'll do the fixes when I can.

elboletaire commented 8 years ago

Changes done :smile: