From 344ce0d3b700d3e844f77034542dcc86ce00458e Mon Sep 17 00:00:00 2001 From: Anton Kasperovich Date: Fri, 12 Apr 2013 10:45:20 +0300 Subject: [PATCH] Fix: BC with symfony 2.1 Commit #5cc7cf212d break compatibility with Symfony 2.1 (or lower), because only in 2.2 added host support in routing. --- Annotation/ApiDoc.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Annotation/ApiDoc.php b/Annotation/ApiDoc.php index ff9e480..2f0b4d5 100644 --- a/Annotation/ApiDoc.php +++ b/Annotation/ApiDoc.php @@ -307,7 +307,13 @@ class ApiDoc public function setRoute(Route $route) { $this->route = $route; - $this->host = $route->getHost() ?: null; + + if (method_exists($route, 'getHost')) { + $this->host = $route->getHost() ? : null; + } else { + $this->host = null; + } + $this->uri = $route->getPattern(); $this->method = $route->getRequirement('_method') ?: 'ANY'; }