Sylius\Component\Core\Repository\PaymentMethodRepositoryInterface::findEnabledForChannel PHP Method

findEnabledForChannel() public method

public findEnabledForChannel ( Sylius\Component\Core\Model\ChannelInterface $channel ) : array
$channel Sylius\Component\Core\Model\ChannelInterface
return array
    public function findEnabledForChannel(ChannelInterface $channel);

Usage Example

 /**
  * {@inheritdoc}
  */
 public function getDefaultPaymentMethod(PaymentInterface $subject)
 {
     /** @var CorePaymentInterface $subject */
     Assert::isInstanceOf($subject, CorePaymentInterface::class);
     /** @var ChannelInterface $channel */
     $channel = $subject->getOrder()->getChannel();
     $paymentMethods = $this->paymentMethodRepository->findEnabledForChannel($channel);
     if (empty($paymentMethods)) {
         throw new UnresolvedDefaultPaymentMethodException();
     }
     return $paymentMethods[0];
 }
All Usage Examples Of Sylius\Component\Core\Repository\PaymentMethodRepositoryInterface::findEnabledForChannel
PaymentMethodRepositoryInterface