for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* another great project.
* You can find more information about us on https://bitbag.shop and write us
* an email on [email protected].
*/
declare(strict_types=1);
namespace BitBag\SyliusQuadPayPlugin\Repository;
use Sylius\Bundle\CoreBundle\Doctrine\ORM\PaymentMethodRepository as BasePaymentMethodRepository;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\PaymentMethodInterface;
final class PaymentMethodRepository extends BasePaymentMethodRepository implements PaymentMethodRepositoryInterface
{
public function findOneByGatewayFactoryNameAndChannel(string $gatewayFactoryName, ChannelInterface $channel): ?PaymentMethodInterface
return $this->createQueryBuilder('o')
->innerJoin('o.gatewayConfig', 'gatewayConfig')
->where('gatewayConfig.factoryName = :gatewayFactoryName')
->andWhere(':channel MEMBER OF o.channels')
->andWhere('o.enabled = true')
->addOrderBy('o.position')
->setParameter('gatewayFactoryName', $gatewayFactoryName)
->setParameter('channel', $channel)
->setMaxResults(1)
->getQuery()
->getOneOrNullResult()
;
}