Use ConstraintDefinitionException instead of RuntimeException
Use object manager instead of entity manager