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

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

    Can anyone suggest where I am going wrong

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 πŸͺ - Explorer

    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

    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

    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

    it is not added, Let me add and check

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 πŸ§‘πŸ»β€πŸš€ - Cadet
    <?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

    Is it correct?

  • sorry, could only jump in now

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 πŸ§‘πŸ»β€πŸš€ - Cadet

    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

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

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 πŸ§‘πŸ»β€πŸš€ - Cadet

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

  • well, first guess: where @UL6DGRULR suggested ☝

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 πŸ§‘πŸ»β€πŸš€ - Cadet

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

  • Alberto Reyer
    Alberto Reyer Lead Spryker Solution Architect / Technical Director Posts: 690 πŸͺ - Explorer

    And does it work?

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 πŸ§‘πŸ»β€πŸš€ - Cadet

    no it is not

  • Unknown
    edited February 2021

    well, the thing is called ShopApplicationDependencyProvider

  • U01AZE27XGV
    U01AZE27XGV Posts: 111 πŸ§‘πŸ»β€πŸš€ - Cadet

    you mean I need to extend ShopApplicationDependecyProvider?

  • Unknown
    edited February 2021

    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

    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

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

  • could please also add the latest error message?