1: <?php
2:
3: namespace Charcoal\Model;
4:
5: use Charcoal\Validator\AbstractValidator as AbstractValidator;
6:
7: 8: 9:
10: class ModelValidator extends AbstractValidator
11: {
12: 13: 14:
15: public function validate()
16: {
17: $model = $this->model;
18:
19: $props = $model->properties();
20:
21: $ret = true;
22: foreach ($props as $ident => $p) {
23: if (!$p || !$p->active()) {
24: continue;
25: }
26: $valid = $p->validate();
27: if ($valid === false) {
28: $validator = $p->validator();
29: $this->merge($validator, $ident);
30: $ret = false;
31: }
32: }
33:
34: return $ret;
35: }
36: }
37: