Symfony2/Doctrine - validation constraint which requires access to a database
问题 I have an entity ArticlePattern , which has a property pattern (string). I need to access the database to check if pattern is correct. So I would like to define a method ArticlePattern::isPatternValid() and add a constraint (using Doctrine's annotation) which would check if isPatternValid is true during validation by Validator object. From what I have read here and there it is not a good idea, to make an entity depended on service container, which mean I cannot access the doctrine service