migration-19.xml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- EN-Revision: 18682 -->
  3. <!-- Reviewed: no -->
  4. <sect1 id="migration.19">
  5. <title>Zend Framework 1.9</title>
  6. <para>
  7. Lors de la migration d'un version précédente vers Zend Framework 1.9 ou plus récent
  8. vous devriez prendre note de ce qui suit.
  9. </para>
  10. <sect2 id="migration.19.zend.filter">
  11. <title>Zend_Filter</title>
  12. <para>
  13. Avant la version 1.9, <classname>Zend_Filter</classname> permettait l'utilisation
  14. de la méthode statique <methodname>get()</methodname>. Avec la version 1.9 cette
  15. méthode a été renommée en <methodname>filterStatic()</methodname> afin d'être plus
  16. descriptive. L'ancienne méthode <methodname>get()</methodname> est marquée comme
  17. dépréciée.
  18. </para>
  19. </sect2>
  20. <sect2 id="migration.19.zend.http.client">
  21. <title>Zend_Http_Client</title>
  22. <sect3 id="migration.19.zend.http.client.fileuploadsarray">
  23. <title>Changement dans le stockage interne des fichiers d'upload</title>
  24. <para>
  25. Dans la version 1.9 de Zend Framework, il y a eu un changement dans la manière dont
  26. <classname>Zend_Http_Client</classname> stocke en interne les informations concernant les
  27. fichiers ayant été uploadés, affectés grâce à <methodname>Zend_Http_Client::setFileUpload()</methodname>
  28. </para>
  29. <para>
  30. Ce changement a été mis en place de manière à permettre l'envoi de plusieurs fichiers
  31. avec le même nom dans le formulaire, en tant que tableau de fichiers. Plus d'informations à
  32. ce sujet peuvent être trouvées dans ce
  33. <ulink url="http://framework.zend.com/issues/browse/ZF-5744">rapport de bug</ulink>.
  34. </para>
  35. <example id="migration.19.zend.http.client.fileuploadsarray.example">
  36. <title>Stockage interne des informations sur les fichiers uploadés</title>
  37. <programlisting language="php"><![CDATA[
  38. // Uploade 2 fichiers avec le même nom d'élément de formulaire, en tant que tableau
  39. $client = new Zend_Http_Client();
  40. $client->setFileUpload('file1.txt', 'userfile[]', 'some raw data', 'text/plain');
  41. $client->setFileUpload('file2.txt', 'userfile[]', 'some other data', 'application/octet-stream');
  42. // Dans Zend Framework <=1.8, la valeur de l'attribut protégé $client->files est:
  43. // $client->files = array(
  44. // 'userfile[]' => array('file2.txt', 'application/octet-stream', 'some other data')
  45. // );
  46. // Dans Zend Framework >=1.9, la valeur de $client->files est:
  47. // $client->files = array(
  48. // array(
  49. // 'formname' => 'userfile[]',
  50. // 'filename' => 'file1.txt,
  51. // 'ctype' => 'text/plain',
  52. // 'data' => 'some raw data'
  53. // ),
  54. // array(
  55. // 'formname' => 'userfile[]',
  56. // 'filename' => 'file2.txt',
  57. // 'formname' => 'application/octet-stream',
  58. // 'formname' => 'some other data'
  59. // )
  60. // );
  61. ]]></programlisting>
  62. </example>
  63. <para>
  64. Comme vous le voyez, ce changement permet l'utilisation du même élément de formulaire avec plusieurs
  65. fichiers. Cependant ceci introduit un changement subtile dans l'API interne, il est donc signalé ici.
  66. </para>
  67. </sect3>
  68. <sect3 id="migration.19.zend.http.client.getparamsrecursize">
  69. <title>Deprecation of Zend_Http_Client::_getParametersRecursive()</title>
  70. <para>
  71. Starting from version 1.9, the protected method <methodname>_getParametersRecursive()</methodname>
  72. is no longer used by <classname>Zend_Http_Client</classname> and is deprecated.
  73. Using it will cause an E_NOTICE message to be emitted by <acronym>PHP</acronym>.
  74. </para>
  75. <para>
  76. If you subclass <classname>Zend_Http_Client</classname> and call this method, you
  77. should look into using the <methodname>Zend_Http_Client::_flattenParametersArray()</methodname>
  78. static method instead.
  79. </para>
  80. <para>
  81. Again, since this <classname>_getParametersRecursive</classname> is a protected method,
  82. this change will only affect users who subclass <classname>Zend_Http_Client</classname>.
  83. </para>
  84. </sect3>
  85. </sect2>
  86. <sect2 id="migration.19.zend.locale">
  87. <title>Zend_Locale</title>
  88. <sect3 id="migration.19.zend.locale.depreciated">
  89. <title>Méthodes dépréciées</title>
  90. <para>
  91. Quelques méthodes de traductions spéciales ont été dépréciées car elles dupliquaient
  92. un comportement existant. Notez cependant que les anciens appels vont toujours
  93. fonctionner, mais une notice utilisateur, qui décrira le nouvel appel, sera émise.
  94. Ces méthodes seront effacées en 2.0. Ci-dessous la liste des anciens et nouveaux
  95. appels&#160;:
  96. </para>
  97. <table id="migration.19.zend.locale.depreciated.table-1">
  98. <title>Liste des types de mesures</title>
  99. <tgroup cols="2">
  100. <thead>
  101. <row>
  102. <entry>Ancien appel</entry>
  103. <entry>Nouvel appel</entry>
  104. </row>
  105. </thead>
  106. <tbody>
  107. <row>
  108. <entry>getLanguageTranslationList($locale)</entry>
  109. <entry>getTranslationList('language', $locale)</entry>
  110. </row>
  111. <row>
  112. <entry>getScriptTranslationList($locale)</entry>
  113. <entry>getTranslationList('script', $locale)</entry>
  114. </row>
  115. <row>
  116. <entry>getCountryTranslationList($locale)</entry>
  117. <entry>getTranslationList('territory', $locale, 2)</entry>
  118. </row>
  119. <row>
  120. <entry>getTerritoryTranslationList($locale)</entry>
  121. <entry>getTranslationList('territory', $locale, 1)</entry>
  122. </row>
  123. <row>
  124. <entry>getLanguageTranslation($value, $locale)</entry>
  125. <entry>getTranslation($value, 'language', $locale)</entry>
  126. </row>
  127. <row>
  128. <entry>getScriptTranslation($value, $locale)</entry>
  129. <entry>getTranslation($value, 'script', $locale)</entry>
  130. </row>
  131. <row>
  132. <entry>getCountryTranslation($value, $locale)</entry>
  133. <entry>getTranslation($value, 'country', $locale)</entry>
  134. </row>
  135. <row>
  136. <entry>getTerritoryTranslation($value, $locale)</entry>
  137. <entry>getTranslation($value, 'territory', $locale)</entry>
  138. </row>
  139. </tbody>
  140. </tgroup>
  141. </table>
  142. </sect3>
  143. </sect2>
  144. <sect2 id="migration.19.zend.view.helper.navigation">
  145. <title>Zend_View_Helper_Navigation</title>
  146. <para>
  147. Prior to the 1.9 release, the menu helper
  148. (<classname>Zend_View_Helper_Navigation_Menu</classname>) did not
  149. render sub menus correctly. When the <code>onlyActiveBranch</code>
  150. was <constant>TRUE</constant> and the option <code>renderParents</code>
  151. <constant>FALSE</constant>, nothing would be rendered if the deepest active
  152. page was at a depth lower than the <code>minDepth</code> option.
  153. </para>
  154. <para>
  155. In simpler words; if <code>minDepth</code> was set to <code>1</code>
  156. and the active page was at one of the first level pages, nothing
  157. would be rendered, as the following example shows.
  158. </para>
  159. <para>
  160. Consider the following container setup:
  161. </para>
  162. <programlisting language="php"><![CDATA[
  163. $container = new Zend_Navigation(array(
  164. array(
  165. 'label' => 'Home',
  166. 'uri' => '#'
  167. ),
  168. array(
  169. 'label' => 'Products',
  170. 'uri' => '#',
  171. 'active' => true,
  172. 'pages' => array(
  173. array(
  174. 'label' => 'Server',
  175. 'uri' => '#'
  176. ),
  177. array(
  178. 'label' => 'Studio',
  179. 'uri' => '#'
  180. )
  181. )
  182. ),
  183. array(
  184. 'label' => 'Solutions',
  185. 'uri' => '#'
  186. )
  187. ));
  188. ]]></programlisting>
  189. <para>
  190. The following code is used in a view script:
  191. </para>
  192. <programlisting language="php"><![CDATA[
  193. echo $this->navigation()->menu()->renderMenu($container, array(
  194. 'minDepth' => 1,
  195. 'onlyActiveBranch' => true,
  196. 'renderParents' => false
  197. ));
  198. ]]></programlisting>
  199. <para>
  200. Before release 1.9, the code snippet above would output nothing.
  201. </para>
  202. <para>
  203. Since release 1.9, the <methodname>_renderDeepestMenu()</methodname> method in
  204. <classname>Zend_View_Helper_Navigation_Menu</classname> will accept
  205. active pages at one level below <code>minDepth</code>, as long as
  206. the page has children.
  207. </para>
  208. <para>
  209. The same code snippet will now output the following:
  210. </para>
  211. <programlisting language="html"><![CDATA[
  212. <ul class="navigation">
  213. <li>
  214. <a href="#">Server</a>
  215. </li>
  216. <li>
  217. <a href="#">Studio</a>
  218. </li>
  219. </ul>
  220. ]]></programlisting>
  221. </sect2>
  222. </sect1>