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

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Order\Model\OrderInterface as BaseOrderInterface;
use Sylius\Component\Core\Model\PromotionCouponInterface;
use Sylius\Component\Core\OrderCheckoutStates;
use Sylius\Component\Core\OrderPaymentStates;
Expand Down Expand Up @@ -419,4 +420,16 @@ public function findCartForSelectingPayment($id): ?OrderInterface

return $order;
}

public function findCartByTokenValue(string $tokenValue): ?BaseOrderInterface
{
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 @@ -90,6 +90,7 @@ public function findOneByTokenValue(string $tokenValue): ?OrderInterface
;
}

/** @deprecated since 1.9 and will be removed in Sylius 2.0, use src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderRepositoryInterface instead */
public function findCartByTokenValue(string $tokenValue): ?OrderInterface
{
return $this->createQueryBuilder('o')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Order\Model\OrderInterface as BaseOrderInterface;
use Sylius\Component\Core\Model\PromotionCouponInterface;
use Sylius\Component\Order\Repository\OrderRepositoryInterface as BaseOrderRepositoryInterface;

Expand Down Expand Up @@ -81,4 +82,6 @@ public function findCartForAddressing($id): ?OrderInterface;
public function findCartForSelectingShipping($id): ?OrderInterface;

public function findCartForSelectingPayment($id): ?OrderInterface;

public function findCartByTokenValue(string $tokenValue): ?BaseOrderInterface;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function findOneByNumber(string $number): ?OrderInterface;

public function findOneByTokenValue(string $tokenValue): ?OrderInterface;

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

public function findCartById($id): ?OrderInterface;
Expand Down