Просмотр исходного кода

ZF-8594: Updated documentation to reflect new behaviour

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20249 44c647ce-9c0f-0410-b52a-842ac1e357ba
dasprid 16 лет назад
Родитель
Сommit
adfa70941e

+ 16 - 3
documentation/manual/en/module_specs/Zend_Controller-Plugins-ErrorHandler.xml

@@ -17,6 +17,10 @@
 
     <itemizedlist>
         <listitem>
+            <para>Intercept exceptions raised when no route matched</para>
+        </listitem>
+
+        <listitem>
             <para>Intercept exceptions raised due to missing controllers or action methods</para>
         </listitem>
 
@@ -28,8 +32,7 @@
     <para>
         In other words, the <emphasis>ErrorHandler</emphasis> plugin is designed to
         handle <acronym>HTTP</acronym> 404-type errors (page missing) and 500-type errors (internal
-        error). It is not intended to catch exceptions raised in other plugins
-        or routing.
+        error). It is not intended to catch exceptions raised in other plugins.
     </para>
 
     <para>
@@ -124,6 +127,13 @@ class ErrorController extends Zend_Controller_Action
         <itemizedlist>
             <listitem>
                 <para>
+                    <constant>Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE</constant>,
+                    indicating no route matched.
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
                     <constant>Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER</constant>,
                     indicating the controller was not found.
                 </para>
@@ -145,7 +155,7 @@ class ErrorController extends Zend_Controller_Action
         </itemizedlist>
 
         <para>
-            You can then test for either of the first two types, and, if so,
+            You can then test for either of the first three types, and, if so,
             indicate a 404 page:
         </para>
 
@@ -157,6 +167,7 @@ class ErrorController extends Zend_Controller_Action
         $errors = $this->_getParam('error_handler');
 
         switch ($errors->type) {
+            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                 // 404 error -- controller or action not found
@@ -186,6 +197,7 @@ public function errorAction()
         $errors = $this->_getParam('error_handler');
 
         switch ($errors->type) {
+            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                 // 404 error -- controller or action not found
@@ -289,6 +301,7 @@ class ErrorController extends Zend_Controller_Action
         $errors = $this->_getParam('error_handler');
 
         switch ($errors->type) {
+            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                 // 404 error -- controller or action not found

+ 42 - 3
documentation/manual/en/ref/migration-110.xml

@@ -8,6 +8,48 @@
         should note the following migration notes.
     </para>
 
+    <sect2 id="migration.110.zend.controller.front">
+        <title>Zend_Controller_Front</title>
+
+        <para>
+            A wrong behaviour was fixed, when there was no module route and no route
+            matched the given request. Previously, the router returned an unmodified
+            request object, so the front controller just displayed the default controller
+            and action. Since Zend Framework 1.10, the router will correctly as noted
+            in the router interface, throw an exception if no route matches. The error
+            plugin will then catch that exception and forward to the error controller.
+            You can then test for that specific error with the constant
+            <constant></constant>:
+        </para>
+
+        <programlisting language="php"><![CDATA[
+/**
+ * Before 1.10
+ */
+    public function errorAction()
+    {
+        $errors = $this->_getParam('error_handler');
+
+        switch ($errors->type) {
+            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
+            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
+    // ...
+
+/**
+ * With 1.10
+ */
+    public function errorAction()
+    {
+        $errors = $this->_getParam('error_handler');
+
+        switch ($errors->type) {
+            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
+            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
+            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
+    // ...
+]]></programlisting>
+    </sect2>
+
     <sect2 id="migration.110.zend.feed.reader">
         <title>Zend_Feed_Reader</title>
 
@@ -56,7 +98,6 @@
 /**
  * Before 1.10
  */
-
 $feed = Zend_Feed_Reader::import('http://example.com/feed');
 $authors = $feed->getAuthors();
 
@@ -65,8 +106,6 @@ $authors = $feed->getAuthors();
  */
 $feed = Zend_Feed_Reader::import('http://example.com/feed');
 $authors = $feed->getAuthors()->getValues();
-
-
 ]]></programlisting>
     </sect2>
 

+ 1 - 0
documentation/manual/en/tutorials/quickstart-create-project.xml

@@ -272,6 +272,7 @@ class ErrorController extends Zend_Controller_Action
         $errors = $this->_getParam('error_handler');
 
         switch ($errors->type) {
+            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: