Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aaabf00

Browse files
committed
[Order] change logalization of findOneByTokenValue function
1 parent 2b8269f commit aaabf00

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderRepository.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,4 +419,16 @@ public function findCartForSelectingPayment($id): ?OrderInterface
419419

420420
return $order;
421421
}
422+
423+
public function findOneByTokenValue(string $tokenValue): ?OrderInterface
424+
{
425+
return $this->createQueryBuilder('o')
426+
->andWhere('o.state != :state')
427+
->andWhere('o.tokenValue = :tokenValue')
428+
->setParameter('state', OrderInterface::STATE_CART)
429+
->setParameter('tokenValue', $tokenValue)
430+
->getQuery()
431+
->getOneOrNullResult()
432+
;
433+
}
422434
}

src/Sylius/Bundle/OrderBundle/Doctrine/ORM/OrderRepository.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public function findOneByNumber(string $number): ?OrderInterface
7878
;
7979
}
8080

81+
/** @deprecated since 1.9 and will be removed in Sylius 2.0, use src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderRepository instead */
8182
public function findOneByTokenValue(string $tokenValue): ?OrderInterface
8283
{
8384
return $this->createQueryBuilder('o')

src/Sylius/Component/Core/Repository/OrderRepositoryInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,6 @@ public function findCartForAddressing($id): ?OrderInterface;
8181
public function findCartForSelectingShipping($id): ?OrderInterface;
8282

8383
public function findCartForSelectingPayment($id): ?OrderInterface;
84+
85+
public function findOneByTokenValue(string $tokenValue): ?OrderInterface;
8486
}

src/Sylius/Component/Order/Repository/OrderRepositoryInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function findLatestCart(): ?OrderInterface;
3030

3131
public function findOneByNumber(string $number): ?OrderInterface;
3232

33+
/** @deprecated since 1.9 and will be removed in Sylius 2.0, use src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderRepositoryInterface instead */
3334
public function findOneByTokenValue(string $tokenValue): ?OrderInterface;
3435

3536
public function findCartByTokenValue(string $tokenValue): ?OrderInterface;

0 commit comments

Comments
 (0)