sokil/php-mongo

when validating a structure: "Validator with name unique not found" exception

sagarguhe opened this issue · 1 comments

I was trying to validate a structure and as per document found a method Document::beforeConstruct() to add a validator namespace. Which will work if used to validate Document but will not work if used to validate structure, because Structure doesn't have such method. So the Structure::getValidatorClassNameByRuleName() method will always look for a validator class in \Sokil\Mongo\Validator\ namespace.

So I think Sokil\Mongo\Structure should also have beforeConstruct() to support global Class level validators.

sokil commented

Done