Pass "services" through from coreRoutes.json to ObjectFactory
authorTim Starling <tstarling@wikimedia.org>
Mon, 23 Sep 2019 05:30:46 +0000 (15:30 +1000)
committerTim Starling <tstarling@wikimedia.org>
Wed, 25 Sep 2019 00:49:25 +0000 (00:49 +0000)
Allows service injection into REST handlers.

Change-Id: I83d1780903febe0499c6a575a0e6725dc01e5b0c

includes/Rest/Router.php

index 6821d89..6dfcf3c 100644 (file)
@@ -276,8 +276,7 @@ class Router {
                $request->setPathParams( array_map( 'rawurldecode', $match['params'] ) );
                $spec = $match['userData'];
                $objectFactorySpec = array_intersect_key( $spec,
-                       // @todo ObjectFactory supports more keys than this.
-                       [ 'factory' => true, 'class' => true, 'args' => true ] );
+                       [ 'factory' => true, 'class' => true, 'args' => true, 'services' => true ] );
                /** @var $handler Handler (annotation for PHPStorm) */
                $handler = $this->objectFactory->createObject( $objectFactorySpec );
                $handler->init( $this, $request, $spec, $this->responseFactory );