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 <acronym>API</acronym> of <classname>Zend_Currency</classname> has changed in the past
  7. to enhance 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 <acronym>API</acronym>.
  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 <constant>NULL</constant>. The optional
  16. script parameter is now an option which can be set through the
  17. <methodname>setFormat()</methodname> method.
  18. </para>
  19. <programlisting language="php"><![CDATA[
  20. $currency = new Zend_Currency($currency, $locale);
  21. ]]></programlisting>
  22. <para>
  23. The <methodname>setFormat()</methodname> method takes now an array of options. These
  24. options are set permanently and override all previously set values. Also a new option
  25. 'precision' has been added. The following options have been refactored:
  26. </para>
  27. <itemizedlist mark='opencircle'>
  28. <listitem>
  29. <para>
  30. <emphasis>position</emphasis>:
  31. Replacement for the old 'rules' parameter.
  32. </para>
  33. </listitem>
  34. <listitem>
  35. <para>
  36. <emphasis>script</emphasis>:
  37. Replacement for the old 'script' parameter.
  38. </para>
  39. </listitem>
  40. <listitem>
  41. <para>
  42. <emphasis>format</emphasis>:
  43. Replacement for the old 'locale' parameter which does not
  44. set new currencies but only the number format.
  45. </para>
  46. </listitem>
  47. <listitem>
  48. <para>
  49. <emphasis>display</emphasis>:
  50. Replacement for the old 'rules' parameter.
  51. </para>
  52. </listitem>
  53. <listitem>
  54. <para>
  55. <emphasis>precision</emphasis>:
  56. New parameter.
  57. </para>
  58. </listitem>
  59. <listitem>
  60. <para>
  61. <emphasis>name</emphasis>:
  62. Replacement for the ole 'rules' parameter. Sets the full
  63. currencies name.
  64. </para>
  65. </listitem>
  66. <listitem>
  67. <para>
  68. <emphasis>currency</emphasis>:
  69. New parameter.
  70. </para>
  71. </listitem>
  72. <listitem>
  73. <para>
  74. <emphasis>symbol</emphasis>:
  75. New parameter.
  76. </para>
  77. </listitem>
  78. </itemizedlist>
  79. <programlisting language="php"><![CDATA[
  80. $currency->setFormat(array $options);
  81. ]]></programlisting>
  82. <para>
  83. The <methodname>toCurrency()</methodname> 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 <methodname>setFormat()</methodname> method.
  86. </para>
  87. <programlisting language="php"><![CDATA[
  88. $currency->toCurrency($value, array $options);
  89. ]]></programlisting>
  90. <para>
  91. The methods <methodname>getSymbol()</methodname>,
  92. <methodname>getShortName()</methodname>, <methodname>getName()</methodname>,
  93. <methodname>getRegionList()</methodname> and
  94. <methodname>getCurrencyList()</methodname> are no longer static and can be called
  95. from within the object. They return the set values of the object if no
  96. parameter has been set.
  97. </para>
  98. </sect2>
  99. </sect1>