Skip to content

Commit 43af90c

Browse files
authored
Merge pull request #18 from rezaf-dev/master
Support Symfony 6.0+
2 parents 95acde6 + 5e18289 commit 43af90c

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Google Drive API Bundle",
55
"require": {
66
"google/apiclient": "^2.2",
7-
"symfony/framework-bundle": "^4.0|^5.1"
7+
"symfony/framework-bundle": "^4.0|^5.1|^6.0"
88
},
99
"license": "MIT",
1010
"authors": [

src/Controller/VatriGoogleDriveAuthController.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Vatri\GoogleDriveBundle\Controller;
44

55
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6+
use Symfony\Component\HttpFoundation\RequestStack;
67
use Symfony\Component\Routing\Annotation\Route;
78
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
89
use Symfony\Component\HttpFoundation\Session\SessionInterface;
@@ -27,10 +28,12 @@ class VatriGoogleDriveAuthController extends AbstractController
2728
*/
2829
private $driveApiService;
2930

30-
public function __construct(ParameterBagInterface $parameterBag, SessionInterface $session, DriveApiService $driveApiService)
31+
public function __construct(ParameterBagInterface $parameterBag, RequestStack $requestStack, DriveApiService $driveApiService)
3132
{
33+
try {
34+
$this->session = $requestStack->getSession();
35+
} catch (\Exception $exception){}
3236
$this->parameterBag = $parameterBag;
33-
$this->session = $session;
3437
$this->driveApiService = $driveApiService;
3538
}
3639
/**

src/Resources/config/vatri_google_drive.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515

1616
vatri_google_drive.api_service:
1717
class: Vatri\GoogleDriveBundle\Service\DriveApiService
18-
arguments: [ '@session', '@parameter_bag', '@vatri_google_drive.cookie_token_storage' ]
18+
arguments: [ '@request_stack', '@parameter_bag', '@vatri_google_drive.cookie_token_storage' ]
1919

2020
# Alias:
2121
Vatri\GoogleDriveBundle\Service\DriveApiService: '@vatri_google_drive.api_service'
@@ -26,5 +26,5 @@ services:
2626
autoconfigure: true
2727
arguments:
2828
$parameterBag: '@parameter_bag'
29-
$session: '@session'
29+
$requestStack: '@request_stack'
3030
$driveApiService: '@vatri_google_drive.api_service'

src/Service/DriveApiService.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Symfony\Component\HttpFoundation\Session\SessionInterface;
77
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
88
use Symfony\Component\HttpFoundation\File\UploadedFile;
9+
use Symfony\Component\HttpFoundation\RequestStack;
910
use Vatri\GoogleDriveBundle\DriveServiceResponse;
1011

1112

@@ -33,9 +34,11 @@ class DriveApiService
3334
private $token_storage;
3435

3536

36-
public function __construct(SessionInterface $session, ParameterBagInterface $parameters, TokenStorageInterface $tokenStorage)
37+
public function __construct(RequestStack $requestStack, ParameterBagInterface $parameters, TokenStorageInterface $tokenStorage)
3738
{
38-
$this->session = $session;
39+
try {
40+
$this->session = $requestStack->getSession();
41+
} catch (\Exception $exception) {}
3942
$this->parameters = $parameters;
4043
$this->token_storage = $tokenStorage;
4144
}

0 commit comments

Comments
 (0)