| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <!-- EN-Revision: 19819 -->
- <sect1 id="migration.110">
- <title>Zend Framework 1.10</title>
- <para>
- 以前のバージョンから Zend Framework 1.10 またはそれ以降に更新する際は、
- 下記の移行上の注意点に注意すべきです。
- </para>
- <!-- TODO : to be translated -->
- <sect2 id="migration.110.zend.feed.reader">
- <title>Zend_Feed_Reader</title>
- <para>
- With the introduction of Zend Framework 1.10, <classname>Zend_Feed_Reader</classname>'s
- handling of retrieving Authors and Contributors was changed, introducing
- a break in backwards compatibility. This change was an effort to harmonise
- the treatment of such data across the RSS and Atom classes of the component
- and enable the return of Author and Contributor data in more accessible,
- usable and detailed form. It also rectifies an error in that it was assumed
- any author element referred to a name. In RSS this is incorrect as an
- author element is actually only required to provide an email address.
- In addition, the original implementation applied its RSS limits to Atom
- feeds significantly reducing the usefulness of the parser with that format.
- </para>
- <para>
- The change means that methods like <methodname>getAuthors()</methodname>
- and <methodname>getContributors</methodname> no longer return a simple array
- of strings parsed from the relevant RSS and Atom elements. Instead, the return
- value is an <classname>ArrayObject</classname> subclass called
- <classname>Zend_Feed_Reader_Collection_Author</classname> which simulates
- an iterable multidimensional array of Authors. Each member of this object
- will be a simple array with three potential keys (as the source data permits).
- These include: name, email and uri.
- </para>
- <para>
- The original behaviour of such methods would have returned a simple
- array of strings, each string attempting to present a single name, but
- in reality this was unreliable since there is no rule governing the format
- of RSS Author strings.
- </para>
- <para>
- The simplest method of simulating the original behaviour of these
- methods is to use the <classname>Zend_Feed_Reader_Collection_Author</classname>'s
- <methodname>getValues()</methodname> which also returns a simple array of strings
- representing the "most relevant data", for authors presumed to be their name.
- Each value in the resulting array is derived from the "name" value
- attached to each Author (if present). In most cases this simple change is
- easy to apply as demonstrated below.
- </para>
- <programlisting language="php"><![CDATA[
- /**
- * Before 1.10
- */
- $feed = Zend_Feed_Reader::import('http://example.com/feed');
- $authors = $feed->getAuthors();
- /**
- * With 1.10
- */
- $feed = Zend_Feed_Reader::import('http://example.com/feed');
- $authors = $feed->getAuthors()->getValues();
- ]]></programlisting>
- </sect2>
- <sect2 id="migration.110.zend.file.transfer">
- <title>Zend_File_Transfer</title>
- <sect3 id="migration.110.zend.file.transfer.count">
- <title>Count 検証</title>
- <para>
- リリース 1.10 より前は <classname>MimeType</classname> バリデータが誤った命名を使っていました。
- 一貫性のために、下記の定数が変更されました。
- </para>
- <table id="migration.110.zend.file.transfer.count.table">
- <title>変更された検証メッセージ</title>
- <tgroup cols="4">
- <thead>
- <row>
- <entry>旧</entry>
- <entry>新</entry>
- <entry>値</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><constant>TOO_MUCH</constant></entry>
- <entry><constant>TOO_MANY</constant></entry>
- <entry>
- Too many files, maximum '%max%' are allowed but '%count%' are given
- </entry>
- </row>
- <row>
- <entry><constant>TOO_LESS</constant></entry>
- <entry><constant>TOO_FEW</constant></entry>
- <entry>
- Too few files, minimum '%min%' are expected but '%count%' are given
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- コード内でこれらのメッセージを翻訳している場合、新しい定数を使います。
- 利点として、正しいつづりを得るために、本来の文字列を翻訳する必要はもうありません。
- </para>
- </sect3>
- </sect2>
- <sect2 id="migration.110.zend.translate">
- <title>Zend_Translate</title>
- <sect3 id="migration.110.zend.translate.xliff">
- <title>Xliff アダプタ</title>
- <para>
- 過去には Xliff アダプタはソースの文字列をメッセージ Id として使いました。
- Xliff 標準に沿って、翻訳単位 Id が使われるべきです。
- この振る舞いは Zend Framework 1.10 で修正されました。
- 今では既定では翻訳単位 Id はメッセージId として使われます。
- </para>
- <para>
- しかし、 <property>useId</property> オプションを <constant>FALSE</constant> に設定することにより、
- 正しくなくて古い振る舞いをまだ得られます。
-
- </para>
- <programlisting language="php"><![CDATA[
- $trans = new Zend_Translate('xliff', '/path/to/source', $locale, array('useId' => false));
- ]]></programlisting>
- </sect3>
- </sect2>
- <sect2 id="migration.110.zend.validate">
- <title>Zend_Validate</title>
- <sect3 id="migration.110.zend.validate.selfwritten">
- <title>書かれたバリデータ自身</title>
- <para>
- かかれたバリデータ自身の内部からエラーを返すよう設定するときは、
- <methodname>_error()</methodname>メソッドを呼ばなくてはいけません。
- Zend Framework 1.10 以前では、パラメータを与えなくてもこのメソッドを呼び出せました。
- そこで、最初に見つかったメッセージテンプレートを使いました。
- </para>
- <para>
- この振る舞いには、一つ以上の異なるメッセージを返すバリデータを使うときに問題があります。
- また、既存のバリデータを拡張すると、予期しない結果を得ることもあります。
- このせいで、あなたが期待した通りではないメッセージにユーザーが遭遇することにもなりました。
- </para>
- <programlisting language="php"><![CDATA[
- My_Validator extends Zend_Validate_Abstract
- {
- public isValid($value)
- {
- ...
- $this->_error(); // 異なるOS間での予期されない結果
- ...
- }
- }
- ]]></programlisting>
- <para>
- この問題を防ぐために、<methodname>_error()</methodname>メソッドにパラメータを与えないで呼び出すことは、
- もはやできなくなります。
- </para>
- <programlisting language="php"><![CDATA[
- My_Validator extends Zend_Validate_Abstract
- {
- public isValid($value)
- {
- ...
- $this->_error(self::MY_ERROR); // 定義されたエラー、予期されない結果ではありません
- ...
- }
- }
- ]]></programlisting>
- </sect3>
- <sect3 id="migration.110.zend.validate.datevalidator">
- <title>日付バリデータの簡略化</title>
- <para>
- Zend Framework 1.10 以前では、同一の2つのメッセージが、
- 日付バリデータ内でスローされていました。
- これらは、<constant>NOT_YYYY_MM_DD</constant>と<constant>FALSEFORMAT</constant>でした。
- Zend Framework 1.10 現在では、
- 与えられた日付が設定されたフォーマットに一致しない場合、
- <constant>FALSEFORMAT</constant>メッセージだけが返されます。
- </para>
- </sect3>
- <sect3 id="migration.110.zend.validate.barcodevalidator">
- <title>Alpha、Alnum及びBarcodeバリデータの修正</title>
- <para>
- Zend Framework 1.10 以前では、バーコード・アダプタ2種類と、
- Alpha 及び Alnum バリデータ内のメッセージが同一でした。
- このため、カスタムのメッセージ、翻訳、
- またはこれらのバリデータの複数のインスタンスを使うときに問題がありました。
- </para>
- <para>
- Zend Framework 1.10 では、定数値は、一意であるように変更されました。
- マニュアルで提案されたように定数を使ったときには、変更がありません。
- しかし、コードで定数の内容を使ったときには、
- それらを変更しなければなりません。
- 下記の表では変更された値を示します。
- </para>
- <table id="migration.110.zend.validate.barcodevalidator.table">
- <title>利用可能なバリデータのメッセージ</title>
- <tgroup cols="3">
- <thead>
- <row>
- <entry>バリデータ</entry>
- <entry>定数</entry>
- <entry>値</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><classname>Alnum</classname></entry>
- <entry><constant>STRING_EMPTY</constant></entry>
- <entry>alnumStringEmpty</entry>
- </row>
- <row>
- <entry><classname>Alpha</classname></entry>
- <entry><constant>STRING_EMPTY</constant></entry>
- <entry>alphaStringEmpty</entry>
- </row>
- <row>
- <entry><classname>Barcode_Ean13</classname></entry>
- <entry><constant>INVALID</constant></entry>
- <entry>ean13Invalid</entry>
- </row>
- <row>
- <entry><classname>Barcode_Ean13</classname></entry>
- <entry><constant>INVALID_LENGTH</constant></entry>
- <entry>ean13InvalidLength</entry>
- </row>
- <row>
- <entry><classname>Barcode_UpcA</classname></entry>
- <entry><constant>INVALID</constant></entry>
- <entry>upcaInvalid</entry>
- </row>
- <row>
- <entry><classname>Barcode_UpcA</classname></entry>
- <entry><constant>INVALID_LENGTH</constant></entry>
- <entry>upcaInvalidLength</entry>
- </row>
- <row>
- <entry><classname>Digits</classname></entry>
- <entry><constant>STRING_EMPTY</constant></entry>
- <entry>digitsStringEmpty</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect3>
- </sect2>
- </sect1>
- <!--
- vim:se ts=4 sw=4 et:
- -->
|