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

Allow null values in TaxonSelectionToCollectionTransformer #1254

Merged

Conversation

umpirsky
Copy link
Contributor

In our project we have:

diff --git a/src/Sylius/Bundle/TaxonomiesBundle/Form/Type/TaxonSelectionType.php b/src/Sylius/Bundle/TaxonomiesBundle/Form/Type/TaxonSelectionType.php
index a9dcb36..9c77828 100644
--- a/src/Sylius/Bundle/TaxonomiesBundle/Form/Type/TaxonSelectionType.php
+++ b/src/Sylius/Bundle/TaxonomiesBundle/Form/Type/TaxonSelectionType.php
@@ -70,6 +70,7 @@ class TaxonSelectionType extends AbstractType
             $builder->add($taxonomy->getId(), 'choice', array(
                 'choice_list' => new ObjectChoiceList($this->taxonRepository->getTaxonsAsList($taxonomy)),
                 'multiple'    => $options['multiple'],
+                'empty_value' => '---',
                 'label'       => /** @Ignore */ $taxonomy->getName()
             ));
         }

This causes ContextErrorException: Warning: Invalid argument supplied for foreach() in src/Sylius/Bundle/TaxonomiesBundle/Form/DataTransformer/TaxonSelectionToCollectionTransformer.php line 83.

@stloyd stloyd added the Bug Fix label Mar 21, 2014
@stloyd stloyd added this to the 1.0.0-BETA1 milestone Mar 21, 2014
stloyd added a commit that referenced this pull request Mar 21, 2014
…Transformer

Allow null values in TaxonSelectionToCollectionTransformer
@stloyd stloyd merged commit a4030e9 into Sylius:master Mar 21, 2014
@stloyd
Copy link
Contributor

stloyd commented Mar 21, 2014

Merged, thanks!

@pjedrzejewski
Copy link
Member

👍

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.

None yet

3 participants