diff options
Diffstat (limited to 'zend/documentation/manual/core/en/migration.10.html')
| -rw-r--r-- | zend/documentation/manual/core/en/migration.10.html | 389 |
1 files changed, 389 insertions, 0 deletions
diff --git a/zend/documentation/manual/core/en/migration.10.html b/zend/documentation/manual/core/en/migration.10.html new file mode 100644 index 0000000..007343f --- /dev/null +++ b/zend/documentation/manual/core/en/migration.10.html @@ -0,0 +1,389 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> + <title>Zend Framework 1.0 - Zend Framework Manual</title> + +</head> +<body> +<table width="100%"> + <tr valign="top"> + <td width="85%"> + <table width="100%"> + <tr> + <td width="25%" style="text-align: left;"> + <a href="migration.15.html">Zend Framework 1.5</a> + </td> + + <td width="50%" style="text-align: center;"> + <div class="up"><span class="up"><a href="migration.html">Zend Gdata Migration Notes</a></span><br /> + <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div> + </td> + + <td width="25%" style="text-align: right;"> + <div class="next" style="text-align: right; float: right;"><a href="migration.09.html">Zend Framework 0.9</a></div> + </td> + </tr> + </table> +<hr /> +<div id="migration.10" class="section"><div class="info"><h1 class="title">Zend Framework 1.0</h1></div> + + + <p class="para"> + When upgrading from a previous release to Zend Framework 1.0 or higher you + should note the following migration notes. + </p> + + <div class="section" id="migration.10.zend.controller" name="migration.10.zend.controller"><div class="info"><h1 class="title">Zend_Controller</h1></div> + + + <p class="para"> + The principal changes introduced in 1.0.0RC1 are the introduction of + and default enabling of the + <a href="" class="link">ErrorHandler</a> + plugin and the <a href="" class="link">ViewRenderer</a> + action helper. Please read the documentation to each thoroughly to + see how they work and what effect they may have on your + applications. + </p> + + <p class="para"> + The <span class="classname">ErrorHandler</span> plugin runs during + <span class="methodname">postDispatch()</span> checking for exceptions, and forwarding + to a specified error handler controller. You should include such a + controller in your application. You may disable it by setting the + front controller parameter <span class="property">noErrorHandler</span>: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$front</span>-><span style="color: #006600;">setParam</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'noErrorHandler'</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + The <span class="classname">ViewRenderer</span> action helper automates view injection + into action controllers as well as autorendering of view scripts + based on the current action. The primary issue you may encounter is + if you have actions that do not render view scripts and neither + forward or redirect, as the <span class="classname">ViewRenderer</span> will attempt + to render a view script based on the action name. + </p> + + <p class="para"> + There are several strategies you can take to update your code. In + the short term, you can globally disable the + <span class="classname">ViewRenderer</span> in your front controller bootstrap prior + to dispatching: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Assuming $front is an instance of Zend_Controller_Front</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$front</span>-><span style="color: #006600;">setParam</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'noViewRenderer'</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + However, this is not a good long term strategy, as it means most + likely you'll be writing more code. + </p> + + <p class="para"> + When you're ready to start using the <span class="classname">ViewRenderer</span> + functionality, there are several things to look for in your + controller code. First, look at your action methods (the methods + ending in 'Action'), and determine what each is doing. If none of + the following is happening, you'll need to make changes: + </p> + + <ul class="itemizedlist"> + <li class="listitem"><p class="para">Calls to <strong class="command">$this->render();</strong></p></li> + <li class="listitem"><p class="para">Calls to <strong class="command">$this->_forward();</strong></p></li> + <li class="listitem"><p class="para">Calls to <strong class="command">$this->_redirect();</strong></p></li> + + <li class="listitem"> + <p class="para">Calls to the <span class="classname">Redirector</span> action helper</p> + </li> + </ul> + + <p class="para"> + The easiest change is to disable auto-rendering for that method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>->_helper-><span style="color: #006600;">viewRenderer</span>-><span style="color: #006600;">setNoRender</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + If you find that none of your action methods are rendering, + forwarding, or redirecting, you will likely want to put the above + line in your <span class="methodname">preDispatch()</span> or <span class="methodname">init()</span> + methods: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> preDispatch<span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #808080; font-style: italic;">// disable view script autorendering</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #0000ff;">$this</span>->_helper-><span style="color: #006600;">viewRenderer</span>-><span style="color: #006600;">setNoRender</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #808080; font-style: italic;">// .. do other things...</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + If you are calling <span class="methodname">render()</span>, and you're using <a href="" class="link">the Conventional Modular + directory structure</a>, you'll want to change your code to + make use of autorendering: + </p> + + <ul class="itemizedlist"> + <li class="listitem"> + <p class="para"> + If you're rendering multiple view scripts in a single + action, you don't need to change a thing. + </p> + </li> + + <li class="listitem"> + <p class="para"> + If you're simply calling <span class="methodname">render()</span> with no + arguments, you can remove such lines. + </p> + </li> + + <li class="listitem"> + <p class="para"> + If you're calling <span class="methodname">render()</span> with arguments, and + not doing any processing afterwards or rendering multiple + view scripts, you can change these calls to read + <strong class="command">$this->_helper->viewRenderer();</strong>. + </p> + </li> + </ul> + + <p class="para"> + If you're not using the conventional modular directory structure, + there are a variety of methods for setting the view base path and + script path specifications so that you can make use of the + <span class="classname">ViewRenderer</span>. Please read the <a href="" class="link">ViewRenderer + documentation</a> for information on these methods. + </p> + + <p class="para"> + If you're using a view object from the registry, or customizing your + view object, or using a different view implementation, you'll want + to inject the <span class="classname">ViewRenderer</span> with this object. This can + be done easily at any time. + </p> + + <ul class="itemizedlist"> + <li class="listitem"> + <p class="para"> + Prior to dispatching a front controller instance: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Assuming $view has already been defined</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$viewRenderer</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Controller_Action_Helper_ViewRenderer<span style="color: #66cc66;">(</span><span style="color: #0000ff;">$view</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Zend_Controller_Action_HelperBroker::<span style="color: #006600;">addHelper</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$viewRenderer</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </li> + + <li class="listitem"> + <p class="para"> + Any time during the bootstrap process: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$viewRenderer</span> =</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> Zend_Controller_Action_HelperBroker::<span style="color: #006600;">getStaticHelper</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'viewRenderer'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$viewRenderer</span>-><span style="color: #006600;">setView</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$view</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </li> + </ul> + + <p class="para"> + There are many ways to modify the <span class="classname">ViewRenderer</span>, + including setting a different view script to render, specifying + replacements for all replaceable elements of a view script path + (including the suffix), choosing a response named segment to + utilize, and more. If you aren't using the conventional modular + directory structure, you can even associate different path + specifications with the <span class="classname">ViewRenderer</span>. + </p> + + <p class="para"> + We encourage you to adapt your code to use the + <span class="classname">ErrorHandler</span> and <span class="classname">ViewRenderer</span> as they are + now core functionality. + </p> + </div> + + <div class="section" id="migration.10.zend.currency" name="migration.10.zend.currency"><div class="info"><h1 class="title">Zend_Currency</h1></div> + + + <p class="para"> + Creating an object of <span class="classname">Zend_Currency</span> has become simpler. + You no longer have to give a script or set it to <b><tt>NULL</tt></b>. The optional + script parameter is now an option which can be set through the + <span class="methodname">setFormat()</span> method. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$currency</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Currency<span style="color: #66cc66;">(</span><span style="color: #0000ff;">$currency</span>, <span style="color: #0000ff;">$locale</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + The <span class="methodname">setFormat()</span> method takes now an array of options. These + options are set permanently and override all previously set values. Also a new option + 'precision' has been added. The following options have been refactored: + </p> + + <ul class="itemizedlist"> + <li class="listitem"> + <p class="para"> + <em class="emphasis">position</em>: + Replacement for the old 'rules' parameter. + </p> + </li> + + <li class="listitem"> + <p class="para"> + <em class="emphasis">script</em>: + Replacement for the old 'script' parameter. + </p> + </li> + + <li class="listitem"> + <p class="para"> + <em class="emphasis">format</em>: + Replacement for the old 'locale' parameter which does not + set new currencies but only the number format. + </p> + </li> + + <li class="listitem"> + <p class="para"> + <em class="emphasis">display</em>: + Replacement for the old 'rules' parameter. + </p> + </li> + + <li class="listitem"> + <p class="para"> + <em class="emphasis">precision</em>: + New parameter. + </p> + </li> + + <li class="listitem"> + <p class="para"> + <em class="emphasis">name</em>: + Replacement for the ole 'rules' parameter. Sets the full + currencies name. + </p> + </li> + + <li class="listitem"> + <p class="para"> + <em class="emphasis">currency</em>: + New parameter. + </p> + </li> + + <li class="listitem"> + <p class="para"> + <em class="emphasis">symbol</em>: + New parameter. + </p> + </li> + </ul> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$currency</span>-><span style="color: #006600;">setFormat</span><span style="color: #66cc66;">(</span><a href="http://www.php.net/array"><span style="color: #000066;">array</span></a> <span style="color: #0000ff;">$options</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + The <span class="methodname">toCurrency()</span> method no longer supports the optional + 'script' and 'locale' parameters. Instead it takes an options array which + can contain the same keys as for the <span class="methodname">setFormat()</span> method. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$currency</span>-><span style="color: #006600;">toCurrency</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$value</span>, <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a> <span style="color: #0000ff;">$options</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + The methods <span class="methodname">getSymbol()</span>, + <span class="methodname">getShortName()</span>, <span class="methodname">getName()</span>, + <span class="methodname">getRegionList()</span> and + <span class="methodname">getCurrencyList()</span> are no longer static and can be called + from within the object. They return the set values of the object if no + parameter has been set. + </p> + </div> +</div> + <hr /> + + <table width="100%"> + <tr> + <td width="25%" style="text-align: left;"> + <a href="migration.15.html">Zend Framework 1.5</a> + </td> + + <td width="50%" style="text-align: center;"> + <div class="up"><span class="up"><a href="migration.html">Zend Gdata Migration Notes</a></span><br /> + <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div> + </td> + + <td width="25%" style="text-align: right;"> + <div class="next" style="text-align: right; float: right;"><a href="migration.09.html">Zend Framework 0.9</a></div> + </td> + </tr> + </table> +</td> + <td style="font-size: smaller;" width="15%"> <style type="text/css"> +#leftbar { + float: left; + width: 186px; + padding: 5px; + font-size: smaller; +} +ul.toc { + margin: 0px 5px 5px 5px; + padding: 0px; +} +ul.toc li { + font-size: 85%; + margin: 1px 0 1px 1px; + padding: 1px 0 1px 11px; + list-style-type: none; + background-repeat: no-repeat; + background-position: center left; +} +ul.toc li.header { + font-size: 115%; + padding: 5px 0px 5px 11px; + border-bottom: 1px solid #cccccc; + margin-bottom: 5px; +} +ul.toc li.active { + font-weight: bold; +} +ul.toc li a { + text-decoration: none; +} +ul.toc li a:hover { + text-decoration: underline; +} +</style> + <ul class="toc"> + <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li> + <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li> + <li class="header up"><a href="migration.html">Zend Gdata Migration Notes</a></li> + <li><a href="migration.112.html">Zend Framework 1.12</a></li> + <li><a href="migration.110.html">Zend Framework 1.10</a></li> + <li><a href="migration.19.html">Zend Framework 1.9</a></li> + <li><a href="migration.18.html">Zend Framework 1.8</a></li> + <li><a href="migration.17.html">Zend Framework 1.7</a></li> + <li><a href="migration.16.html">Zend Framework 1.6</a></li> + <li><a href="migration.15.html">Zend Framework 1.5</a></li> + <li class="active"><a href="migration.10.html">Zend Framework 1.0</a></li> + <li><a href="migration.09.html">Zend Framework 0.9</a></li> + <li><a href="migration.08.html">Zend Framework 0.8</a></li> + <li><a href="migration.06.html">Zend Framework 0.6</a></li> + </ul> + </td> + </tr> +</table> +</body> +</html>
\ No newline at end of file |
