Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

form fieldset issue #18

Open
ceadreak opened this issue May 17, 2016 · 1 comment
Open

form fieldset issue #18

ceadreak opened this issue May 17, 2016 · 1 comment
Labels

Comments

@ceadreak
Copy link
Contributor

Hi,

I have a problem with this module when using form collection in my application.

This works great, but if a form contains a collection, an error is thrown :
Zend\Form\FormElementManager::get was unable to fetch or create an instance for my.fieldset.form.config.key

An example to reproduce it :

  • Create a form collection and insert it in a form

        $this->add([
            'type'    => Collection::class,
            'name'    => 'categories',
            'options' => [
                'label'                  => 'Categories,
                'count'                  => 0,
                'should_create_template' => true,
                'allow_add'              => true,
                'create_new_objects'     => true,
                'target_element'         =>
                    [
                        'type' => 'categories.fieldset',
                    ],
            ],
        ]);
    
  • Define the fieldset

    class CategoryFieldset extends \Zend\Form\Fieldset
    {
        // fieldset fields definition ....
    }
    
  • Define the configuration in the form config file

    'categories.fieldset'                        => function ($sl)
                {
                    $fieldset = new CategoryFieldset();
                    $fieldset->setHydrator(new ClassMethods());
                    $fieldset->setObject(new Category());
    
                    return $fieldset;
                },
    

So for now, instead of add the ImageThumb module in the application config and inject the ImageThumbService from serviceLocator to my controllers, I just create a new instance.

Cheers,
Ceadreak

@bacinsky
Copy link
Member

bacinsky commented Jun 8, 2016

Hi, thank you for your report. Could you please provide a better use case that I can test and find the bug. I cant imagine how a form fieldset chould be related to the image thumb service. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants