mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 02:13:15 +00:00
fix api version
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Alchemy\Phrasea\Controller\Api;
|
namespace Alchemy\Phrasea\Controller\Api;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\ControllerProvider\Api\V1;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
@@ -267,7 +268,13 @@ class Result
|
|||||||
public function getVersion()
|
public function getVersion()
|
||||||
{
|
{
|
||||||
if (null === $this->version) {
|
if (null === $this->version) {
|
||||||
$this->version = $this->request->attributes->get('api_version') ?: self::$defaultVersion;
|
if($this->request->attributes->get('api_version')){
|
||||||
|
$this->version = $this->request->attributes->get('api_version');
|
||||||
|
}elseif(mb_strpos($this->request->getPathInfo(), '/api/v1') !== FALSE){
|
||||||
|
$this->version = V1::VERSION;
|
||||||
|
}else{
|
||||||
|
$this->version = self::$defaultVersion;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->version;
|
return $this->version;
|
||||||
|
|||||||
Reference in New Issue
Block a user