migration-110.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="migration.110">
  4. <title>Zend Framework 1.10</title>
  5. <para>
  6. When upgrading from a previous release to Zend Framework 1.10 or higher you
  7. should note the following migration notes.
  8. </para>
  9. <sect2 id="migration.110.zend.file.transfer">
  10. <title>Zend_File_Transfer</title>
  11. <sect3 id="migration.110.zend.file.transfer.count">
  12. <title>Count validation</title>
  13. <para>
  14. Before release 1.10 the <classname>MimeType</classname> validator used a wrong
  15. naming. For consistency the following constants have been changed:
  16. </para>
  17. <table id="migration.110.zend.file.transfer.count.table">
  18. <title>Changed Validation Messages</title>
  19. <tgroup cols="4">
  20. <thead>
  21. <row>
  22. <entry>Old</entry>
  23. <entry>New</entry>
  24. <entry>Value</entry>
  25. </row>
  26. </thead>
  27. <tbody>
  28. <row>
  29. <entry><constant>TOO_MUCH</constant></entry>
  30. <entry><constant>TOO_MANY</constant></entry>
  31. <entry>
  32. Too many files, maximum '%max%' are allowed but '%count%' are given
  33. </entry>
  34. </row>
  35. <row>
  36. <entry><constant>TOO_LESS</constant></entry>
  37. <entry><constant>TOO_FEW</constant></entry>
  38. <entry>
  39. Too few files, minimum '%min%' are expected but '%count%' are given
  40. </entry>
  41. </row>
  42. </tbody>
  43. </tgroup>
  44. </table>
  45. <para>
  46. When you are translating these messages within your code then use the new constants.
  47. As benefit you don't need to translate the original string anymore to get a correct
  48. spelling.
  49. </para>
  50. </sect3>
  51. </sect2>
  52. <sect2 id="migration.110.zend.validate">
  53. <title>Zend_Validate</title>
  54. <sect3 id="migration.110.zend.validate.selfwritten">
  55. <title>Self written validators</title>
  56. <para>
  57. When setting returning a error from within a self written validator you have to
  58. call the <methodname>_error()</methodname> method. Before Zend Framework 1.10 you
  59. were able to call this method without giving a parameter. It used then the first
  60. found message template.
  61. </para>
  62. <para>
  63. This behaviour is problematic when you have validators with more than one different
  64. message to be returned. Also when you extend an existing validator you can get
  65. unexpected results. This could lead to the problem that your user get not the
  66. message you expected.
  67. </para>
  68. <programlisting language="php"><![CDATA[
  69. My_Validator extends Zend_Validate_Abstract
  70. {
  71. public isValid($value)
  72. {
  73. ...
  74. $this->_error(); // unexpected results between different OS
  75. ...
  76. }
  77. }
  78. ]]></programlisting>
  79. <para>
  80. To prevent this problem the <methodname>_error()</methodname> method is no longer
  81. allowed to be called without giving a parameter.
  82. </para>
  83. <programlisting language="php"><![CDATA[
  84. My_Validator extends Zend_Validate_Abstract
  85. {
  86. public isValid($value)
  87. {
  88. ...
  89. $this->_error(self::MY_ERROR); // defined error, no unexpected results
  90. ...
  91. }
  92. }
  93. ]]></programlisting>
  94. </sect3>
  95. <sect3 id="migration.110.zend.validate.datevalidator">
  96. <title>Simplification in date validator</title>
  97. <para>
  98. Before Zend Framework 1.10 2 identical messages were thrown within the date
  99. validator. These were <constant>NOT_YYYY_MM_DD</constant> and
  100. <constant>FALSEFORMAT</constant>. As of Zend Framework 1.10 only the
  101. <constant>FALSEFORMAT</constant> message will be returned when the given date
  102. does not match the set format.
  103. </para>
  104. </sect3>
  105. <sect3 id="migration.110.zend.validate.barcodevalidator">
  106. <title>Fixes in Alpha, Alnum and Barcode validator</title>
  107. <para>
  108. Before Zend Framework 1.10 the messages within the 2 barcode adapters, the Alpha
  109. and the Alnum validator were identical. This introduced problems when using custom
  110. messages, translations or multiple instances of these validators.
  111. </para>
  112. <para>
  113. As with Zend Framework 1.10 the values of the constants were changed to
  114. be unique. When you used the constants as proposed in the manual there is
  115. no change for you. But when you used the content of the constants in your code
  116. then you will have to change them. The following table shows you the changed values:
  117. </para>
  118. <table id="migration.110.zend.validate.barcodevalidator.table">
  119. <title>Available Validation Messages</title>
  120. <tgroup cols="3">
  121. <thead>
  122. <row>
  123. <entry>Validator</entry>
  124. <entry>Constant</entry>
  125. <entry>Value</entry>
  126. </row>
  127. </thead>
  128. <tbody>
  129. <row>
  130. <entry><classname>Alnum</classname></entry>
  131. <entry><constant>STRING_EMPTY</constant></entry>
  132. <entry>alnumStringEmpty</entry>
  133. </row>
  134. <row>
  135. <entry><classname>Alpha</classname></entry>
  136. <entry><constant>STRING_EMPTY</constant></entry>
  137. <entry>alphaStringEmpty</entry>
  138. </row>
  139. <row>
  140. <entry><classname>Barcode_Ean13</classname></entry>
  141. <entry><constant>INVALID</constant></entry>
  142. <entry>ean13Invalid</entry>
  143. </row>
  144. <row>
  145. <entry><classname>Barcode_Ean13</classname></entry>
  146. <entry><constant>INVALID_LENGTH</constant></entry>
  147. <entry>ean13InvalidLength</entry>
  148. </row>
  149. <row>
  150. <entry><classname>Barcode_UpcA</classname></entry>
  151. <entry><constant>INVALID</constant></entry>
  152. <entry>upcaInvalid</entry>
  153. </row>
  154. <row>
  155. <entry><classname>Barcode_UpcA</classname></entry>
  156. <entry><constant>INVALID_LENGTH</constant></entry>
  157. <entry>upcaInvalidLength</entry>
  158. </row>
  159. <row>
  160. <entry><classname>Digits</classname></entry>
  161. <entry><constant>STRING_EMPTY</constant></entry>
  162. <entry>digitsStringEmpty</entry>
  163. </row>
  164. </tbody>
  165. </tgroup>
  166. </table>
  167. </sect3>
  168. </sect2>
  169. </sect1>
  170. <!--
  171. vim:se ts=4 sw=4 et:
  172. -->