Zend_Currency-Migrating.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.currency.migration">
  4. <title>Migrating from Previous Versions</title>
  5. <para>
  6. The API of <classname>Zend_Currency</classname> has changed in the past to enhance
  7. usability. If you started using <classname>Zend_Currency</classname> with a
  8. version which is mentioned in this chapter follow the guidelines below
  9. to migrate your scripts to the new API.
  10. </para>
  11. <sect2 id="zend.currency.usage.migration.fromonezerotwo">
  12. <title>Migrating from 1.0.2 to 1.0.3 or Newer</title>
  13. <para>
  14. Creating an object of <classname>Zend_Currency</classname> has become simpler.
  15. You no longer have to give a script or set it to null. The optional
  16. script parameter is now an option which can be set through the
  17. <code>setFormat()</code> method.
  18. </para>
  19. <programlisting language="php"><![CDATA[
  20. $currency = new Zend_Currency($currency, $locale);
  21. ]]></programlisting>
  22. <para>
  23. The <code>setFormat()</code> method takes now an array of options. These options are set
  24. permanently and override all previously set values. Also a new option 'precision' has
  25. been added. The following options have been refactored:
  26. <itemizedlist mark='opencircle'>
  27. <listitem>
  28. <para>
  29. <emphasis>position</emphasis>:
  30. Replacement for the old 'rules' parameter.
  31. </para>
  32. </listitem>
  33. <listitem>
  34. <para>
  35. <emphasis>script</emphasis>:
  36. Replacement for the old 'script' parameter.
  37. </para>
  38. </listitem>
  39. <listitem>
  40. <para>
  41. <emphasis>format</emphasis>:
  42. Replacement for the old 'locale' parameter which does not
  43. set new currencies but only the number format.
  44. </para>
  45. </listitem>
  46. <listitem>
  47. <para>
  48. <emphasis>display</emphasis>:
  49. Replacement for the old 'rules' parameter.
  50. </para>
  51. </listitem>
  52. <listitem>
  53. <para>
  54. <emphasis>precision</emphasis>:
  55. New parameter.
  56. </para>
  57. </listitem>
  58. <listitem>
  59. <para>
  60. <emphasis>name</emphasis>:
  61. Replacement for the ole 'rules' parameter. Sets the full
  62. currencies name.
  63. </para>
  64. </listitem>
  65. <listitem>
  66. <para>
  67. <emphasis>currency</emphasis>:
  68. New parameter.
  69. </para>
  70. </listitem>
  71. <listitem>
  72. <para>
  73. <emphasis>symbol</emphasis>:
  74. New parameter.
  75. </para>
  76. </listitem>
  77. </itemizedlist>
  78. </para>
  79. <programlisting language="php"><![CDATA[
  80. $currency->setFormat(array $options);
  81. ]]></programlisting>
  82. <para>
  83. The <code>toCurrency()</code> method no longer supports the optional
  84. 'script' and 'locale' parameters. Instead it takes an options array which
  85. can contain the same keys as for the <code>setFormat</code> method.
  86. </para>
  87. <programlisting language="php"><![CDATA[
  88. $currency->toCurrency($value, array $options);
  89. ]]></programlisting>
  90. <para>
  91. The methods <code>getSymbol()</code>, <code>getShortName()</code>,
  92. <code>getName()</code>, <code>getRegionList()</code> and
  93. <code>getCurrencyList()</code> are no longer static and can be called
  94. from within the object. They return the set values of the object if no
  95. parameter has been set.
  96. </para>
  97. </sect2>
  98. </sect1>