// src/AppBundle/Entity/Book.phpnamespaceAppBundle\Entity;useSymfony\Component\Validator\Mapping\ClassMetadata;useSymfony\Component\Validator\ConstraintsasAssert;classBook{protected$isbn;publicstaticfunctionloadValidatorMetadata(ClassMetadata$metadata){$metadata->addPropertyConstraint('isbn',newAssert\Isbn(array('type'=>'isbn10','message'=>'This value is not valid.')));}}