[Pkg-owncloud-commits] [owncloud-doc] 17/110: ControllerMethodReflector is not available on stable7

David Prévot taffit at moszumanska.debian.org
Fri Feb 6 21:10:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud-doc.

commit 338d269565c42171c36450c98331a743e9076b2b
Author: Olivier Paroz <oparoz at users.noreply.github.com>
Date:   Sun Dec 14 00:42:00 2014 +0100

    ControllerMethodReflector is not available on stable7
    
    ControllerMethodReflector is still a private class on OC7 and so it's not "legally" possible to use it, so it's best not to promote its use in the official documentation.
---
 developer_manual/app/middleware.rst | 72 -------------------------------------
 1 file changed, 72 deletions(-)

diff --git a/developer_manual/app/middleware.rst b/developer_manual/app/middleware.rst
index 1a73053..e0b7799 100644
--- a/developer_manual/app/middleware.rst
+++ b/developer_manual/app/middleware.rst
@@ -73,75 +73,3 @@ The middleware can be registered in the :doc:`container` and added using the **r
 .. note::
 
   The order is important! The middleware that is registered first gets run first in the **beforeController** method. For all other hooks, the order is being reversed, meaning: if a middleware is registered first, it gets run last.
-
-
-Parsing annotations 
-===================
-Sometimes its useful to conditionally execute code before or after a controller method. This can be done by defining custom annotations. An example would be to add a custom authentication method or simply add an additional header to the response. To access the parsed annotations, inject the **ControllerMethodReflector** class:
-
-.. code-block:: php
-
-  <?php
-
-  namespace OCA\MyApp\Middleware;
-
-  use \OCP\AppFramework\Middleware;
-  use \OCP\AppFramework\Utility\ControllerMethodReflector;
-  use \OCP\IRequest;
-
-  class HeaderMiddleware extends Middleware {
-
-    private $reflector;
-
-    public function __construct(ControllerMethodReflector $reflector) {
-        $this->reflector = $reflector;
-    }
-
-    /**
-     * Add custom header if @MyHeader is used
-     */
-    public function afterController($controller, $methodName, IResponse $response){
-        if($this->reflector->hasAnnotation('MyHeader')) {
-            $response->addHeader('My-Header', 3);
-        }
-        return $response;
-    }
-
-  }
-
-Now adjust the container to inject the reflector:
-
-.. code-block:: php
-
-  <?php
-
-  namespace OCA\MyApp\AppInfo;
-
-  use \OCP\AppFramework\App;
-
-  use \OCA\MyApp\Middleware\HeaderMiddleware;
-
-  class MyApp extends App {
-
-      /**
-       * Define your dependencies in here
-       */
-      public function __construct(array $urlParams=array()){
-          parent::__construct('myapp', $urlParams);
-  
-          $container = $this->getContainer();
-  
-          /**
-           * Middleware
-           */
-          $container->registerService('HeaderMiddleware', function($c){
-              return new HeaderMiddleware($c->query('ControllerMethodReflector'));
-          });
-
-          // executed in the order that it is registered
-          $container->registerMiddleware('HeaderMiddleware');
-      }
-
-  }
-
-.. note:: An annotation always starts with an uppercase letter

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-doc.git



More information about the Pkg-owncloud-commits mailing list