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.
I was trying to validate a structure and as per document found a method
Document::beforeConstruct()
to add a validatornamespace
. Which will work if used to validateDocument
but will not work if used to validate structure, becauseStructure
doesn't have such method. So theStructure::getValidatorClassNameByRuleName()
method will always look for a validator class in\Sokil\Mongo\Validator\
namespace.So I think
Sokil\Mongo\Structure
should also havebeforeConstruct()
to support global Class level validators.