Skip to content

Commit

Permalink
Merge pull request #28 from drekinov/fix-orm-2-3-setparameters
Browse files Browse the repository at this point in the history
doctrine/orm v3 compatibility fix
  • Loading branch information
klapaudius authored Sep 2, 2024
2 parents 8ad6cb4 + 916a4f3 commit 260d2bd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
6 changes: 4 additions & 2 deletions Entity/AuthCodeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use FOS\OAuthServerBundle\Model\AuthCodeInterface;
use FOS\OAuthServerBundle\Model\AuthCodeManager as BaseAuthCodeManager;

use function time;

class AuthCodeManager extends BaseAuthCodeManager
{
/**
Expand Down Expand Up @@ -80,8 +82,8 @@ public function deleteExpired(): int
$qb = $repository->createQueryBuilder('a');
$qb
->delete()
->where('a.expiresAt < ?1')
->setParameters([1 => time()])
->where('a.expiresAt < :time')
->setParameter('time', time())
;

return $qb->getQuery()->execute();
Expand Down
6 changes: 4 additions & 2 deletions Entity/TokenManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
use FOS\OAuthServerBundle\Model\TokenInterface;
use FOS\OAuthServerBundle\Model\TokenManager as BaseTokenManager;

use function time;

class TokenManager extends BaseTokenManager
{
/**
Expand Down Expand Up @@ -88,8 +90,8 @@ public function deleteExpired(): int
$qb = $this->repository->createQueryBuilder('t');
$qb
->delete()
->where('t.expiresAt < ?1')
->setParameters([1 => time()])
->where('t.expiresAt < :time')
->setParameter('time', time())
;

return $qb->getQuery()->execute();
Expand Down
8 changes: 4 additions & 4 deletions Tests/Entity/AuthCodeManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ public function testDeleteExpired(): void
$queryBuilder
->expects($this->once())
->method('where')
->with('a.expiresAt < ?1')
->with('a.expiresAt < :time')
->willReturn($queryBuilder)
;

$queryBuilder
->expects($this->once())
->method('setParameters')
->with([1 => time()])
->method('setParameter')
->with('time', time())
->willReturn($queryBuilder)
;

Expand All @@ -202,4 +202,4 @@ public function testDeleteExpired(): void

$this->assertSame($randomResult, $this->instance->deleteExpired());
}
}
}
6 changes: 3 additions & 3 deletions Tests/Entity/TokenManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ public function testDeleteExpired(): void
$queryBuilder
->expects($this->once())
->method('where')
->with('t.expiresAt < ?1')
->with('t.expiresAt < :time')
->willReturn($queryBuilder)
;

$queryBuilder
->expects($this->once())
->method('setParameters')
->with([1 => time()])
->method('setParameter')
->with('time', time())
->willReturn($queryBuilder)
;

Expand Down

0 comments on commit 260d2bd

Please sign in to comment.