getExistingPaymentMethods example

public function __construct(
        private readonly EntityRepository $paymentMethodRepository,
        private readonly MediaService $mediaService,
        private readonly AbstractAppLoader $appLoader,
    ) {
        $this->mimeDetector = new FinfoMimeTypeDetector();
    }

    public function updatePaymentMethods(Manifest $manifest, string $appId, string $defaultLocale, Context $context): void
    {
        $existingPaymentMethods = $this->getExistingPaymentMethods($manifest->getMetadata()->getName()$appId$context);

        $payments = $manifest->getPayments();
        $paymentMethods = $payments !== null ? $payments->getPaymentMethods() : [];
        $upserts = [];

        foreach ($paymentMethods as $paymentMethod) {
            $payload = $paymentMethod->toArray($defaultLocale);
            $payload['handlerIdentifier'] = sprintf('app\\%s_%s', $manifest->getMetadata()->getName()$paymentMethod->getIdentifier());

            /** @var PaymentMethodEntity|null $existing */
            $existing = $existingPaymentMethods->filterByProperty('handlerIdentifier', $payload['handlerIdentifier'])->first();
            
Home | Imprint | This part of the site doesn't use cookies.