From 0ebdec70d1a27bccc51b51774edfc597f9f13ec4 Mon Sep 17 00:00:00 2001 From: faraz_elmo Date: Fri, 3 Aug 2018 15:32:58 +1000 Subject: [PATCH 1/2] bugfix; Annotations 'ThriftBundle:Thrift:server' no longer work for Symfony 4 when passing '_controller'. Passing 'Overblog\ThriftBundle\Controller\ThriftController::serverAction' instead --- Routing/ThriftRoutingLoader.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Routing/ThriftRoutingLoader.php b/Routing/ThriftRoutingLoader.php index 45f455f..a6322a2 100644 --- a/Routing/ThriftRoutingLoader.php +++ b/Routing/ThriftRoutingLoader.php @@ -11,6 +11,7 @@ namespace Overblog\ThriftBundle\Routing; +use App\Kernel; use Symfony\Component\Config\Loader\Loader; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; @@ -27,18 +28,23 @@ public function __construct($services) /** * Loads a resource. * - * @param mixed $resource The resource - * @param string|null $type The resource type or null if unknown + * @param mixed $resource The resource + * @param string|null $type The resource type or null if unknown * + * @return RouteCollection * @throws \Exception If something went wrong */ public function load($resource, $type = null) { + $controllerArg = Kernel::VERSION_ID > 40000 ? + 'Overblog\ThriftBundle\Controller\ThriftController::serverAction' : + 'ThriftBundle:Thrift:server'; + $coll = new RouteCollection(); foreach ($this->services as $path => $service) { $route = new Route( '/'.$path, - ['_controller' => 'ThriftBundle:Thrift:server', 'extensionName' => $path], + ['_controller' => $controllerArg, 'extensionName' => $path], [], [], null, From facfd0d3c18dfe3de43d3d0f8950656f1b083433 Mon Sep 17 00:00:00 2001 From: faraz_elmo Date: Fri, 3 Aug 2018 15:47:52 +1000 Subject: [PATCH 2/2] bugfix; fixed namespace for Kernel --- Routing/ThriftRoutingLoader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Routing/ThriftRoutingLoader.php b/Routing/ThriftRoutingLoader.php index a6322a2..1f90102 100644 --- a/Routing/ThriftRoutingLoader.php +++ b/Routing/ThriftRoutingLoader.php @@ -11,7 +11,7 @@ namespace Overblog\ThriftBundle\Routing; -use App\Kernel; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\Loader; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection;