以前のバージョンからの移行
Zend_ValidateのAPIは、時折変わってきました。
以前のバージョンでZend_Validateとそのサブコンポーネントを使い始めたなら、
新しいAPIを使うようスクリプトを移行するために、下記のガイドラインに従ってください。
1.9から1.10以降への移行
書かれたアダプタ自身
かかれたバリデータ自身の内部からエラーを返すよう設定するときは、
_error()メソッドを呼ばなくてはいけません。
Zend Framework 1.10 以前では、パラメータを与えなくてもこのメソッドを呼び出せました。
そこで、最初に見つかったメッセージテンプレートを使いました。
この振る舞いには、一つ以上の異なるメッセージを返すバリデータを使うときに問題があります。
また、既存のバリデータを拡張すると、予期しない結果を得ることもあります。
このせいで、あなたが期待した通りではないメッセージにユーザーが遭遇することにもなりました。
_error(); // 異なるOS間での予期されない結果
...
}
}
]]>
この問題を防ぐために、_error()メソッドにパラメータを与えないで呼び出すことは、
もはやできなくなります。
_error(self::MY_ERROR); // 定義されたエラー、予期されない結果ではありません
...
}
}
]]>
Simplification in date validator
Before Zend Framework 1.10 2 identical messages were thrown within the date
validator. These were NOT_YYYY_MM_DD and
FALSEFORMAT. As of Zend Framework 1.10 only the
FALSEFORMAT message will be returned when the given date
does not match the set format.
Fixes in Alpha, Alnum and Barcode validator
Before Zend Framework 1.10 the messages within the 2 barcode adapters, the Alpha
and the Alnum validator were identical. This introduced problems when using custom
messages, translations or multiple instances of these validators.
As with Zend Framework 1.10 the values of the constants were changed to
be unique. When you used the constants as proposed in the manual there is
no change for you. But when you used the content of the constants in your code
then you will have to change them. The following table shows you the changed values:
Available Validation Messages
Validator
Constant
Value
Alnum
STRING_EMPTY
alnumStringEmpty
Alpha
STRING_EMPTY
alphaStringEmpty
Barcode_Ean13
INVALID
ean13Invalid
Barcode_Ean13
INVALID_LENGTH
ean13InvalidLength
Barcode_UpcA
INVALID
upcaInvalid
Barcode_UpcA
INVALID_LENGTH
upcaInvalidLength
Digits
STRING_EMPTY
digitsStringEmpty