Validating object inside object

How I can validate an object from $this->request->getPost() that has inside other object? For example:

In AJAX data:
{ "something": { "value" : "someValue" } }

In server:
$validator->add("value", ...)


20.4k

I'm trying a workaround sending a JSON.stringify(...) instead of an Object of Objects, but the validator always success in the validation, even with very different values.



6.1k
edited Sep '14

Im afraid you have to create custom validation to validate your object

you can follow this guide to make your custome validation http://docs.phalconphp.com/en/latest/reference/validation.html#validators



20.4k

I think I'll be using a string for that little thing (custom validator will be more work than).

THe problem is that I had discovered that everything I send to validate (for that object), even in a string form (1#a$2#b) returns true, no matter what the pattern is (and the vars are setted correctly).



20.4k

Well, I think this can't go worse.

It seems that Phalcon validates OK everything I send, no matter what. And I'm doing the validation the same as in the login, and there I don't have fails.