/** * Validates an entity. * * @param AnDomainEntityAbstract $entity The entity to be validatd * * @return bool */ public function validate($entity) { //reset the error message $context = $this->getCommandContext(); $context->entity = $entity; if ($entity->isValidatable()) { $entity->resetErrors(); } $result = $this->getCommandChain()->run('on.validate', $context); return $result !== false; }