It can be not only FormType, also can be any your custom form type.
It can be when you moved your form into new namespace/bundle, but did not registered services in it.
- don't forget that your form should extend Symfony\Component\Form\AbstractType;
- add new bundle namespace in composer.json
- Create bundle extension file in ./DependencyInjection/FooExtenstion like this https://symfony.com/doc/current/bundles/extension.html
- add this into your bundle services.yaml:
services:
    # default configuration for services in *this* file
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true
    FooBundle\:
        resource: '../src/'
        exclude:
            - '../src/DependencyInjection/'
            - '../src/Entity/'
            - '../src/Kernel.php'
            - '../src/Tests/'
        5. run php bin/console cache:clear
 
Комментариев нет:
Отправить комментарий