Skip to content

Commit

Permalink
[Order] change logalization of findOneByTokenValue function
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamKasp committed Nov 10, 2020
1 parent 2b8269f commit aaabf00
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,4 +419,16 @@ public function findCartForSelectingPayment($id): ?OrderInterface

return $order;
}

public function findOneByTokenValue(string $tokenValue): ?OrderInterface
{
return $this->createQueryBuilder('o')
->andWhere('o.state != :state')
->andWhere('o.tokenValue = :tokenValue')
->setParameter('state', OrderInterface::STATE_CART)
->setParameter('tokenValue', $tokenValue)
->getQuery()
->getOneOrNullResult()
;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function findOneByNumber(string $number): ?OrderInterface
;
}

/** @deprecated since 1.9 and will be removed in Sylius 2.0, use src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderRepository instead */
public function findOneByTokenValue(string $tokenValue): ?OrderInterface
{
return $this->createQueryBuilder('o')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,6 @@ public function findCartForAddressing($id): ?OrderInterface;
public function findCartForSelectingShipping($id): ?OrderInterface;

public function findCartForSelectingPayment($id): ?OrderInterface;

public function findOneByTokenValue(string $tokenValue): ?OrderInterface;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function findLatestCart(): ?OrderInterface;

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

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

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

0 comments on commit aaabf00

Please sign in to comment.