Issn

Edit this page

Warning: You are browsing the documentation for Symfony 2.5, which is no longer maintained.

Read the updated version of this page for Symfony 6.1 (the current stable version).

Issn

2.3

The Issn constraint was introduced in Symfony 2.3.

Validates that a value is a valid International Standard Serial Number (ISSN).

Basic Usage

  • YAML
  • Annotations
  • XML
  • PHP
1
2
3
4
5
# src/Acme/JournalBundle/Resources/config/validation.yml
Acme\JournalBundle\Entity\Journal:
    properties:
        issn:
            - Issn: ~

Options

message

type: String default: This value is not a valid ISSN.

The message shown if the given value is not a valid ISSN.

caseSensitive

type: Boolean default: false

The validator will allow ISSN values to end with a lower case 'x' by default. When switching this to true, the validator requires an upper case 'X'.

requireHyphen

type: Boolean default: false

The validator will allow non hyphenated ISSN values by default. When switching this to true, the validator requires a hyphenated ISSN value.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.