php - Zend Framework 2 with Doctrine 2 custom validation and object structure -
what proper class , object structure supports custom validations in zf2 , doctrine2?
for example, have simple user entity, , wish check if email provided unique. validation requires access entitymanager
can't done entity in getinputfilter
method.
what proper application structure support that?
in current workflow user's name validated in controller, seems kind of wrong. relevant objects , scripts view: edituser.phtml controller: usercontroller.php - gets user post input , serves - creates validator, , checks if ($validator->isvalid()) entity: user.php - performs other basic property validation, cannot perform isunique
if need create custom validation class, object instantiate , use it? absolutely need have separate user business model apart entity, have healthy oop structure ?