PageRenderTime 49ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/php/files/ZendGdata-1.12.3/documentation/manual/core/en/migration.15.html

https://bitbucket.org/xaca/grabarvideosams
HTML | 235 lines | 209 code | 26 blank | 0 comment | 0 complexity | f3c4df19e69327e034606d23ff595f96 MD5 | raw file
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  6. <title>Zend Framework 1.5 - Zend Framework Manual</title>
  7. </head>
  8. <body>
  9. <table width="100%">
  10. <tr valign="top">
  11. <td width="85%">
  12. <table width="100%">
  13. <tr>
  14. <td width="25%" style="text-align: left;">
  15. <a href="migration.16.html">Zend Framework 1.6</a>
  16. </td>
  17. <td width="50%" style="text-align: center;">
  18. <div class="up"><span class="up"><a href="migration.html">Zend Gdata Migration Notes</a></span><br />
  19. <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
  20. </td>
  21. <td width="25%" style="text-align: right;">
  22. <div class="next" style="text-align: right; float: right;"><a href="migration.10.html">Zend Framework 1.0</a></div>
  23. </td>
  24. </tr>
  25. </table>
  26. <hr />
  27. <div id="migration.15" class="section"><div class="info"><h1 class="title">Zend Framework 1.5</h1></div>
  28. <p class="para">
  29. When upgrading from a previous release to Zend Framework 1.5 or higher you
  30. should note the following migration notes.
  31. </p>
  32. <div class="section" id="migration.15.zend.controller" name="migration.15.zend.controller"><div class="info"><h1 class="title">Zend_Controller</h1></div>
  33. <p class="para">
  34. Though most basic functionality remains the same, and all documented
  35. functionality remains the same, there is one particular
  36. <em class="emphasis">undocumented</em> &quot;feature&quot; that has changed.
  37. </p>
  38. <p class="para">
  39. When writing <acronym class="acronym">URL</acronym>s, the documented way to write camelCased action
  40. names is to use a word separator; these are &#039;.&#039; or &#039;-&#039; by default,
  41. but may be configured in the dispatcher. The dispatcher internally
  42. lowercases the action name, and uses these word separators to
  43. re-assemble the action method using camelCasing. However, because <acronym class="acronym">PHP</acronym>
  44. functions are not case sensitive, you <em class="emphasis">could</em>
  45. still write <acronym class="acronym">URL</acronym>s using camelCasing, and the dispatcher would resolve
  46. these to the same location. For example, &#039;camel-cased&#039; would become
  47. &#039;camelCasedAction&#039; by the dispatcher, whereas &#039;camelCased&#039; would
  48. become &#039;camelcasedAction&#039;; however, due to the case insensitivity of
  49. <acronym class="acronym">PHP</acronym>, both will execute the same method.
  50. </p>
  51. <p class="para">
  52. This causes issues with the ViewRenderer when resolving view
  53. scripts. The canonical, documented way is that all word separators
  54. are converted to dashes, and the words lowercased. This creates
  55. a semantic tie between the actions and view scripts, and the
  56. normalization ensures that the scripts can be found. However, if the
  57. action &#039;camelCased&#039; is called and actually resolves, the word
  58. separator is no longer present, and the ViewRenderer attempts to
  59. resolve to a different location -- <var class="filename">camelcased.phtml</var> instead of
  60. <var class="filename">camel-cased.phtml</var>.
  61. </p>
  62. <p class="para">
  63. Some developers relied on this &quot;feature&quot;, which was never intended.
  64. Several changes in the 1.5.0 tree, however, made it so that the
  65. ViewRenderer no longer resolves these paths; the semantic tie is now
  66. enforced. First among these, the dispatcher now enforces case
  67. sensitivity in action names. What this means is that referring to
  68. your actions on the url using camelCasing will no longer resolve to
  69. the same method as using word separators (i.e., &#039;camel-casing&#039;).
  70. This leads to the ViewRenderer now only honoring the word-separated
  71. actions when resolving view scripts.
  72. </p>
  73. <p class="para">
  74. If you find that you were relying on this &quot;feature&quot;, you have several
  75. options:
  76. </p>
  77. <ul class="itemizedlist">
  78. <li class="listitem">
  79. <p class="para">
  80. Best option: rename your view scripts. Pros: forward
  81. compatibility. Cons: if you have many view scripts that
  82. relied on the former, unintended behavior, you will have a
  83. lot of renaming to do.
  84. </p>
  85. </li>
  86. <li class="listitem">
  87. <p class="para">
  88. Second best option: The ViewRenderer now delegates view
  89. script resolution to <span class="classname">Zend_Filter_Inflector</span>; you
  90. can modify the rules of the inflector to no longer separate
  91. the words of an action with a dash:
  92. </p>
  93. <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>
  94. <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;">&nbsp; &nbsp; Zend_Controller_Action_HelperBroker::<span style="color: #006600;">getStaticHelper</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'viewRenderer'</span><span style="color: #66cc66;">&#41;</span>;</div></li>
  95. <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;">$inflector</span> = <span style="color: #0000ff;">$viewRenderer</span>-&gt;<span style="color: #006600;">getInflector</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li>
  96. <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;">$inflector</span>-&gt;<span style="color: #006600;">setFilterRule</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">':action'</span>, <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span></div></li>
  97. <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;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> Zend_Filter_PregReplace<span style="color: #66cc66;">&#40;</span></div></li>
  98. <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;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'#[^a-z0-9'</span> . <a href="http://www.php.net/preg_quote"><span style="color: #000066;">preg_quote</span></a><span style="color: #66cc66;">&#40;</span>DIRECTORY_SEPARATOR, <span style="color: #ff0000;">'#'</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">']+#i'</span>,</div></li>
  99. <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;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">''</span></div></li>
  100. <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;">&nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>,</div></li>
  101. <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;">&nbsp; &nbsp; <span style="color: #ff0000;">'StringToLower'</span></div></li>
  102. <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;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></div></div></div>
  103. <p class="para">
  104. The above code will modify the inflector to no longer
  105. separate the words with dash; you may also want to remove
  106. the &#039;StringToLower&#039; filter if you <em class="emphasis">do</em>
  107. want the actual view script names camelCased as well.
  108. </p>
  109. <p class="para">
  110. If renaming your view scripts would be too tedious or time
  111. consuming, this is your best option until you can find the
  112. time to do so.
  113. </p>
  114. </li>
  115. <li class="listitem">
  116. <p class="para">
  117. Least desirable option: You can force the dispatcher to
  118. dispatch camelCased action names with a new front controller
  119. flag, <span class="property">useCaseSensitiveActions</span>:
  120. </p>
  121. <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>-&gt;<span style="color: #006600;">setParam</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'useCaseSensitiveActions'</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></div></div></div>
  122. <p class="para">
  123. This will allow you to use camelCasing on the url and still
  124. have it resolve to the same action as when you use word
  125. separators. However, this will mean that the original issues
  126. will cascade on through; you will likely need to use the
  127. second option above in addition to this for things to work
  128. at all reliably.
  129. </p>
  130. <p class="para">
  131. Note, also, that usage of this flag will raise a notice that
  132. this usage is deprecated.
  133. </p>
  134. </li>
  135. </ul>
  136. </div>
  137. </div>
  138. <hr />
  139. <table width="100%">
  140. <tr>
  141. <td width="25%" style="text-align: left;">
  142. <a href="migration.16.html">Zend Framework 1.6</a>
  143. </td>
  144. <td width="50%" style="text-align: center;">
  145. <div class="up"><span class="up"><a href="migration.html">Zend Gdata Migration Notes</a></span><br />
  146. <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
  147. </td>
  148. <td width="25%" style="text-align: right;">
  149. <div class="next" style="text-align: right; float: right;"><a href="migration.10.html">Zend Framework 1.0</a></div>
  150. </td>
  151. </tr>
  152. </table>
  153. </td>
  154. <td style="font-size: smaller;" width="15%"> <style type="text/css">
  155. #leftbar {
  156. float: left;
  157. width: 186px;
  158. padding: 5px;
  159. font-size: smaller;
  160. }
  161. ul.toc {
  162. margin: 0px 5px 5px 5px;
  163. padding: 0px;
  164. }
  165. ul.toc li {
  166. font-size: 85%;
  167. margin: 1px 0 1px 1px;
  168. padding: 1px 0 1px 11px;
  169. list-style-type: none;
  170. background-repeat: no-repeat;
  171. background-position: center left;
  172. }
  173. ul.toc li.header {
  174. font-size: 115%;
  175. padding: 5px 0px 5px 11px;
  176. border-bottom: 1px solid #cccccc;
  177. margin-bottom: 5px;
  178. }
  179. ul.toc li.active {
  180. font-weight: bold;
  181. }
  182. ul.toc li a {
  183. text-decoration: none;
  184. }
  185. ul.toc li a:hover {
  186. text-decoration: underline;
  187. }
  188. </style>
  189. <ul class="toc">
  190. <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li>
  191. <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li>
  192. <li class="header up"><a href="migration.html">Zend Gdata Migration Notes</a></li>
  193. <li><a href="migration.112.html">Zend Framework 1.12</a></li>
  194. <li><a href="migration.110.html">Zend Framework 1.10</a></li>
  195. <li><a href="migration.19.html">Zend Framework 1.9</a></li>
  196. <li><a href="migration.18.html">Zend Framework 1.8</a></li>
  197. <li><a href="migration.17.html">Zend Framework 1.7</a></li>
  198. <li><a href="migration.16.html">Zend Framework 1.6</a></li>
  199. <li class="active"><a href="migration.15.html">Zend Framework 1.5</a></li>
  200. <li><a href="migration.10.html">Zend Framework 1.0</a></li>
  201. <li><a href="migration.09.html">Zend Framework 0.9</a></li>
  202. <li><a href="migration.08.html">Zend Framework 0.8</a></li>
  203. <li><a href="migration.06.html">Zend Framework 0.6</a></li>
  204. </ul>
  205. </td>
  206. </tr>
  207. </table>
  208. </body>
  209. </html>