protected function registerEntityValidator(Repository $config)
    {
        $this->app->singleton(Factories\EntityValidationFactory::class, function ($app) use ($config) {
            $factory = new Factories\EntityValidationFactory(
                $app->make(Factories\HydratorFactory::class), $app['validator']
            );

            foreach ($config->get('doctrine_validation.mappings') as $entity => $rules) {
                $factory->addEntityRulesMapping($entity, $app->make($rules));
            }

            return $factory;
        });
    }