Calling Developers!
We are reenergizing our code contribution process! Learn More

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..

I am creating a form following

Options
U01AZE27XGV
U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet

I am creating a form following https://documentation.spryker.com/docs/en/t-working-forms#create-the-formtype, getting the below error Call to undefined method getFormFactory()

«1

Comments

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options

    Can anyone suggest where I am going wrong

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer
    Options

    Does your factory extends Spryker\Yves\Kernel\AbstractFactory?

    If it does, are you sure your factory receives the dependency?

        /**
         * @return \Symfony\Component\Form\FormFactoryInterface
         */
        public function getFormFactory(): FormFactoryInterface
        {
            return $this->getProvidedDependency(ApplicationConstants::FORM_FACTORY);
        }
    

    If all this works, take a look at the Spryker\Yves\Form\Plugin\Application\FormApplicationPlugin and if it is added to Pyz\Yves\Application\ApplicationDependencyProvider::getApplicationPlugins()

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options

    when factory is receiving dependency it is throwing Spryker\Yves\Kernel\ClassResolver\DependencyProvider\DependencyProviderNotFoundException

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer
    Options

    If all this works, take a look at the Spryker\Yves\Form\Plugin\Application\FormApplicationPlugin and if it is added to Pyz\Yves\Application\ApplicationDependencyProvider::getApplicationPlugins()

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options

    it is not added, Let me add and check

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options
    <?php
    declare(strict_types = 1);
    
    /**
     * This file is part of the Spryker Commerce OS.
     * For full license information, please view the LICENSE file that was distributed with this source code.
     */
    namespace Pyz\Yves\Form;
    use Pyz\Yves\Application\ApplicationDependencyProvider as SprykerApplicationDependencyProvider;
    
    class ApplicationDependencyProvider extends SprykerApplicationDependencyProvider
    {
        /**
         * @return \Spryker\Shared\ApplicationExtension\Dependency\Plugin\ApplicationPluginInterface[]
         */
        protected function getApplicationPlugins(): array
        {
            $plugins = [
                new FormApplicationPlugin(),
            ];
    
            return $plugins;
    
        }
    }
    
  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options

    Is it correct?

  • hi

  • sorry, could only jump in now

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options

    Hi Marco

  • the above is surely not correct. since you add an ApplicationDependencyProvider from the Application Module to the Form namespace

  • but let me read the whole thread first 😊

  • also, these questions surely do not belong in , rather in if there is no channel available that is more specific

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer
    Options

    You need to add it to Pyz\Yves\Application\ApplicationDependencyProvider and there in the getApplicationPlugins() .

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options

    @UJN2JRU4F let me know where do I need to add this

  • well, first guess: where @UL6DGRULR suggested ☝

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options

    As suggested, have added to Pyz\Yves\Application\ApplicationDependencyProvider

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer
    Options

    And does it work?

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options

    no it is not

  • Unknown
    edited February 2021
    Options

    well, the thing is called ShopApplicationDependencyProvider

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options

    you mean I need to extend ShopApplicationDependecyProvider?

  • Unknown
    edited February 2021
    Options

    think the original suggestion was to make sure it is there

  • you probably do not need to extend anything

  • i think yu need to share significantly more code

  • Everything that is related to the above error message

  • the controller, the factory, the dependency provider

  • Unknown
    edited February 2021
    Options

    these things should be provided by default when you request help here. this will allow people to speed up the assistance process 🙂

  • ☝ you can still do that, btw 😉

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 🧑🏻‍🚀 - Cadet
    Options

    Sorry for delay, here are the controller, factory and dependency provider files

  • could please also add the latest error message?