Issn

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

値が有効な国際標準シリアル番号 (ISSN) であることを検証します。
Applies to property or method
Class Issn
Validator IssnValidator

Basic Usage

  • Attributes
    属性
  • YAML
    YAML
  • XML
    XML
  • PHP
    PHP
1
2
3
4
5
6
7
8
9
10
// src/Entity/Journal.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

class Journal
{
    #[Assert\Issn]
    protected $issn;
}

Note

ノート

As with most of the other constraints, null and empty strings are considered valid values. This is to allow them to be optional values. If the value is mandatory, a common solution is to combine this constraint with NotBlank.

他のほとんどの制約と同様に、null および空の文字列は有効な値と見なされます。これは、それらをオプションの値にできるようにするためです。値が必須の場合、一般的な解決策は、この制約と NotBlank を組み合わせることです。

Options

caseSensitive

type: boolean default: false

タイプ: ブール デフォルト: 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'.

バリデーターは、デフォルトで ISSN 値が小文字の「x」で終わることを許可します。これを true に切り替えると、バリデーターは大文字の「X」を必要とします。

groups

type: array | string

タイプ: 配列 |ストリング

It defines the validation group or groups of this constraint. Read more about validation groups.

この制約の検証グループを定義します。検証グループの詳細を参照してください。

message

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

タイプ: 文字列 デフォルト: この値は有効な ISSN ではありません。

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

指定された値が有効な ISSN でない場合に表示されるメッセージ。

You can use the following parameters in this message:

このメッセージでは、次のパラメーターを使用できます。
Parameter Description
{{ value }} The current (invalid) value
{{ label }} Corresponding form field label

payload

type: mixed default: null

タイプ: 混合 デフォルト: null

This option can be used to attach arbitrary domain-specific data to a constraint. The configured payload is not used by the Validator component, but its processing is completely up to you.

このオプションは、任意のドメイン固有のデータを制約に添付するために使用できます。構成されたペイロードは Validator コンポーネントによって使用されませんが、その処理は完全にユーザー次第です。

For example, you may want to use several error levels to present failed constraints differently in the front-end depending on the severity of the error.

たとえば、いくつかのエラー レベルを使用して、エラーの重大度に応じて、失敗した制約をフロントエンドで異なる方法で提示することができます。

requireHyphen

type: boolean default: false

タイプ: ブール デフォルト: false

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

バリデーターは、デフォルトでハイフンなしの ISSN 値を許可します。これを true に切り替えると、バリデータはハイフンでつながれた ISSN 値を必要とします。