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

[ResourceBundle] Check if collection form prototype is defined #2412

Merged

Conversation

adamelso
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets n/a
License MIT
Doc PR n/a

If you specify allow_add to false when building a form collection property, this will result in a Twig error:

Variable "prototype" does not exist

In the same form theme template, a check is done to see prototype is defined and allow_add is true on part of the template, so this same has been done here to fix this issue.

public function buildForm(FormBuilderInterface $builder, array $options)
{
        $builder ->add('attributes', 'collection', [
                'required'     => false,
                'type'         => 'sylius_advertisement_attribute_value',
                'allow_add'    => false,
                'allow_delete' => false,
                'by_reference' => false
        ]);

@TeatroIO
Copy link

I've prepared a stage to preview changes. Open stage or view logs.

pjedrzejewski pushed a commit that referenced this pull request Jan 31, 2015
…otype

[ResourceBundle] Check if collection form prototype is defined
@pjedrzejewski pjedrzejewski merged commit d6c2b11 into Sylius:master Jan 31, 2015
@pjedrzejewski
Copy link
Member

Thank you Adam! 👍

@adamelso adamelso deleted the prevent-error-for-no-form-prototype branch January 31, 2015 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants