What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hello all, I am extending the CheckoutPage module inside Yves and added the CheckoutPageFactory.php

U048WDEP3R7
U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
edited November 2022 in Help

Hello all,

I am extending the CheckoutPage module inside Yves and added the CheckoutPageFactory.php. But the CheckoutController is resolving CheckoutPageFactory from the vender folder instead of the current folder. Any tips to fix this?

This is my CheckoutController.php code:

<?php
namespace Pyz\Yves\CheckoutPage\Controller;

use Pyz\Yves\CheckoutPage\Form\FormFactory;
use SprykerShop\Yves\CheckoutPage\Controller\CheckoutController as SprykerShopCheckoutController;
use Symfony\Component\HttpFoundation\Request;

/**
 * @method \Pyz\Yves\CheckoutPage\CheckoutPageFactory getFactory()
 */
class CheckoutController extends SprykerShopCheckoutController
{
    /**
     * @param Request $request
     *
     * @return mixed
     */
    public function voucherAction(Request $request)
    {
        $checkoutFormFactory = $this->getFactory() // Gets the CheckoutPageFactory from the vendor/spryker/checkoutPage/src/Yves/... folder instead of the current module folder
            ->createCheckoutFormFactory();

        $stepProcess = $this->createStepProcess();

        $response = $stepProcess->process(
            $request,
            $checkoutFormFactory->createVoucherFormCollection()
        );

        if (!is_array($response)) {
            return $response;
        }

        return $this->view(
            $response,
            $this->getFactory()->getCustomerPageWidgetPlugins(),
            '@CheckoutPage/views/voucher/voucher.twig'
        );
    }
}

Comments

  • sebastian.larisch
    sebastian.larisch Spryker Customer Posts: 143 🧑🏻‍🚀 - Cadet

    looks correct actually. and your CheckoutPageFactory extends the one from vendor correctly and u added the public function createCheckoutFormFactory(): FormFactory method?

  • giovanni.piemontese
    giovanni.piemontese Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet

    class resolver cache maybe forgotten?

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet

    @UNGMX0012 @UL65CH0MC I had to delete the folder and pull again from the repository. Now it works.