migration-19.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="migration.19">
  4. <title>Zend Framework 1.9</title>
  5. <para>
  6. When upgrading from a previous release to Zend Framework 1.9 or higher you
  7. should note the following migration notes.
  8. </para>
  9. <sect2 id="migration.19.zend.filter">
  10. <title>Zend_Filter</title>
  11. <para>
  12. Prior to the 1.9 release, <classname>Zend_Filter</classname> allowed
  13. the usage of the static <methodname>get()</methodname> method. As with
  14. release 1.9 this method has been renamed to
  15. <methodname>filterStatic()</methodname> to be more descriptive. The
  16. old <methodname>get()</methodname> method is marked as deprecated.
  17. </para>
  18. </sect2>
  19. <sect2 id="migration.19.zend.http.client">
  20. <title>Zend_Http_Client</title>
  21. <sect3 id="migration.19.zend.http.client.fileuploadsarray">
  22. <title>Changes to internal uploaded file information storage</title>
  23. <para>
  24. In version 1.9 of Zend Framework, there has been a change in the way
  25. <classname>Zend_Http_Client</classname> internally stores information about
  26. files to be uploaded, set using the <methodname>Zend_Http_Client::setFileUpload()</methodname>
  27. method.
  28. </para>
  29. <para>
  30. This change was introduced in order to allow multiple files to be uploaded
  31. with the same form name, as an array of files. More information about this issue
  32. can be found in <ulink url="http://framework.zend.com/issues/browse/ZF-5744">this bug report</ulink>.
  33. </para>
  34. <example id="migration.19.zend.http.client.fileuploadsarray.example">
  35. <title>Internal storage of uploaded file information</title>
  36. <programlisting language="php"><![CDATA[
  37. // Upload two files with the same form element name, as an array
  38. $client = new Zend_Http_Client();
  39. $client->setFileUpload('file1.txt',
  40. 'userfile[]',
  41. 'some raw data',
  42. 'text/plain');
  43. $client->setFileUpload('file2.txt',
  44. 'userfile[]',
  45. 'some other data',
  46. 'application/octet-stream');
  47. // In Zend Framework 1.8 or older, the value of
  48. // the protected member $client->files is:
  49. // $client->files = array(
  50. // 'userfile[]' => array('file2.txt',
  51. 'application/octet-stream',
  52. 'some other data')
  53. // );
  54. // In Zend Framework 1.9 or newer, the value of $client->files is:
  55. // $client->files = array(
  56. // array(
  57. // 'formname' => 'userfile[]',
  58. // 'filename' => 'file1.txt,
  59. // 'ctype' => 'text/plain',
  60. // 'data' => 'some raw data'
  61. // ),
  62. // array(
  63. // 'formname' => 'userfile[]',
  64. // 'filename' => 'file2.txt',
  65. // 'formname' => 'application/octet-stream',
  66. // 'formname' => 'some other data'
  67. // )
  68. // );
  69. ]]></programlisting>
  70. </example>
  71. <para>
  72. As you can see, this change permits the usage of the same form element name with
  73. more than one file - however, it introduces a subtle backwards-compatibility change
  74. and as such should be noted.
  75. </para>
  76. </sect3>
  77. <sect3 id="migration.19.zend.http.client.getparamsrecursize">
  78. <title>Deprecation of Zend_Http_Client::_getParametersRecursive()</title>
  79. <para>
  80. Starting from version 1.9, the protected method <methodname>_getParametersRecursive()</methodname>
  81. is no longer used by <classname>Zend_Http_Client</classname> and is deprecated.
  82. Using it will cause an E_NOTICE message to be emitted by <acronym>PHP</acronym>.
  83. </para>
  84. <para>
  85. If you subclass <classname>Zend_Http_Client</classname> and call this method, you
  86. should look into using the <methodname>Zend_Http_Client::_flattenParametersArray()</methodname>
  87. static method instead.
  88. </para>
  89. <para>
  90. Again, since this <classname>_getParametersRecursive</classname> is a protected method,
  91. this change will only affect users who subclass <classname>Zend_Http_Client</classname>.
  92. </para>
  93. </sect3>
  94. </sect2>
  95. <sect2 id="migration.19.zend.locale">
  96. <title>Zend_Locale</title>
  97. <sect3 id="migration.19.zend.locale.depreciated">
  98. <title>Depreciated methods</title>
  99. <para>
  100. Some specialized translation methods have been depreciated because they duplicate
  101. existing behaviour. Note that the old methods will still work, but a user notice is
  102. triggered which describes the new call. The methods will be erased with 2.0.
  103. See the following list for old and new method call.
  104. </para>
  105. <table id="migration.19.zend.locale.depreciated.table-1">
  106. <title>List of measurement types</title>
  107. <tgroup cols="2">
  108. <thead>
  109. <row>
  110. <entry>Old call</entry>
  111. <entry>New call</entry>
  112. </row>
  113. </thead>
  114. <tbody>
  115. <row>
  116. <entry>getLanguageTranslationList($locale)</entry>
  117. <entry>getTranslationList('language', $locale)</entry>
  118. </row>
  119. <row>
  120. <entry>getScriptTranslationList($locale)</entry>
  121. <entry>getTranslationList('script', $locale)</entry>
  122. </row>
  123. <row>
  124. <entry>getCountryTranslationList($locale)</entry>
  125. <entry>getTranslationList('territory', $locale, 2)</entry>
  126. </row>
  127. <row>
  128. <entry>getTerritoryTranslationList($locale)</entry>
  129. <entry>getTranslationList('territory', $locale, 1)</entry>
  130. </row>
  131. <row>
  132. <entry>getLanguageTranslation($value, $locale)</entry>
  133. <entry>getTranslation($value, 'language', $locale)</entry>
  134. </row>
  135. <row>
  136. <entry>getScriptTranslation($value, $locale)</entry>
  137. <entry>getTranslation($value, 'script', $locale)</entry>
  138. </row>
  139. <row>
  140. <entry>getCountryTranslation($value, $locale)</entry>
  141. <entry>getTranslation($value, 'country', $locale)</entry>
  142. </row>
  143. <row>
  144. <entry>getTerritoryTranslation($value, $locale)</entry>
  145. <entry>getTranslation($value, 'territory', $locale)</entry>
  146. </row>
  147. </tbody>
  148. </tgroup>
  149. </table>
  150. </sect3>
  151. </sect2>
  152. <sect2 id="migration.19.zend.view.helper.navigation">
  153. <title>Zend_View_Helper_Navigation</title>
  154. <para>
  155. Prior to the 1.9 release, the menu helper
  156. (<classname>Zend_View_Helper_Navigation_Menu</classname>) did not
  157. render sub menus correctly. When the <code>onlyActiveBranch</code>
  158. was <constant>TRUE</constant> and the option <code>renderParents</code>
  159. <constant>FALSE</constant>, nothing would be rendered if the deepest active
  160. page was at a depth lower than the <code>minDepth</code> option.
  161. </para>
  162. <para>
  163. In simpler words; if <code>minDepth</code> was set to <code>1</code>
  164. and the active page was at one of the first level pages, nothing
  165. would be rendered, as the following example shows.
  166. </para>
  167. <para>
  168. Consider the following container setup:
  169. </para>
  170. <programlisting language="php"><![CDATA[
  171. <?php
  172. $container = new Zend_Navigation(array(
  173. array(
  174. 'label' => 'Home',
  175. 'uri' => '#'
  176. ),
  177. array(
  178. 'label' => 'Products',
  179. 'uri' => '#',
  180. 'active' => true,
  181. 'pages' => array(
  182. array(
  183. 'label' => 'Server',
  184. 'uri' => '#'
  185. ),
  186. array(
  187. 'label' => 'Studio',
  188. 'uri' => '#'
  189. )
  190. )
  191. ),
  192. array(
  193. 'label' => 'Solutions',
  194. 'uri' => '#'
  195. )
  196. ));
  197. ]]></programlisting>
  198. <para>
  199. The following code is used in a view script:
  200. </para>
  201. <programlisting language="php"><![CDATA[
  202. <?php echo $this->navigation()->menu()->renderMenu($container, array(
  203. 'minDepth' => 1,
  204. 'onlyActiveBranch' => true,
  205. 'renderParents' => false
  206. )); ?>
  207. ]]></programlisting>
  208. <para>
  209. Before release 1.9, the code snippet above would output nothing.
  210. </para>
  211. <para>
  212. Since release 1.9, the <methodname>_renderDeepestMenu()</methodname> method in
  213. <classname>Zend_View_Helper_Navigation_Menu</classname> will accept
  214. active pages at one level below <code>minDepth</code>, as long as
  215. the page has children.
  216. </para>
  217. <para>
  218. The same code snippet will now output the following:
  219. </para>
  220. <programlisting language="html"><![CDATA[
  221. <ul class="navigation">
  222. <li>
  223. <a href="#">Server</a>
  224. </li>
  225. <li>
  226. <a href="#">Studio</a>
  227. </li>
  228. </ul>
  229. ]]></programlisting>
  230. </sect2>
  231. </sect1>
  232. <!--
  233. vim:se ts=4 sw=4 et:
  234. -->