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

Add validators for attributes #56

Open
purekid opened this issue Mar 28, 2014 · 5 comments
Open

Add validators for attributes #56

purekid opened this issue Mar 28, 2014 · 5 comments
Labels

Comments

@purekid
Copy link
Owner

purekid commented Mar 28, 2014

Validating data with specify rules of attribute , throw error messages when validating failed.

Inspired by: http://laravel.com/docs/validation#rule-in

    protected static $attrs = array(

        'age' => array('type'=>'integer','rules'=>'required|min:5|max:100'),
        'gender' => array('type'=>'string','rules'=>'in:male,female')

    );
@jrschumacher
Copy link
Collaborator

Hmm interesting concept. Is there a way we can include a 3rd party library of validators to use? I don't know of any off hand but I will look.

@wildsurfer
Copy link
Contributor

@jrschumacher what about this one https://github.com/symfony/Validator?

@jrschumacher
Copy link
Collaborator

@wildsurfer yea that looks good @purekid thoughts?

@purekid
Copy link
Owner Author

purekid commented Mar 29, 2014

That looks good,let's find a way to extend it.

@macedd
Copy link

macedd commented Apr 24, 2014

BTW, just arrived and this is the best PHP Mongo Library I've found...

Just one question (out of docs): @purekid how is validation currently working? I'm looking for save and find data casting to make the usage more error prone.

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

No branches or pull requests

4 participants