<p dir="auto">In Symfony 2.7 only, works fine in 2.6.*</p>
<pre class="notranslate">$builder-&gt;add('typeVoie', 'entity', array(
                'class' =&gt; 'MyBundle:TypeVoie',
                'query_builder' =&gt; function(EntityRepository $er) {
                    return $er-&gt;createQueryBuilder('u')
                    -&gt;orderBy('u.weight', 'DESC');
                },
                'property' =&gt; 'typeVoieLower',
                'label' =&gt; 'Type de voie',
                'label_attr' =&gt; array('id' =&gt; 'label_typevoie'),
                'required' =&gt; false
)
</pre>
<p dir="auto">Despite the option <code class="notranslate">required =&gt; false</code> the form does not accept null values and returns</p>
<p dir="auto"><code class="notranslate">SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: ""</code></p>
<p dir="auto">The entity definition has the option <code class="notranslate">nullable=true</code> set on this field.</p>
<p dir="auto">Thanks</p>
<p dir="auto">I think that's happening only on propel + postgres after <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/webmozart/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/webmozart">@webmozart</a> removed empty/null checks from ChoiceToValueTransformer in <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/symfony/symfony/commit/1d89922782922fe3bcacb09f91e8c3c992d29d3f/hovercard" href="https://github.com/symfony/symfony/commit/1d89922782922fe3bcacb09f91e8c3c992d29d3f"><tt>1d89922</tt></a></p>
<p dir="auto">ModelChoiceList-&gt;getChoicesForValues allows to create Propel query with empty string values which are not accepted, so I'm getting:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Unable to execute SELECT statement [SELECT (...) FROM twilio_number WHERE twilio_number.id IN (:p1)] [wrapped: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: &quot;&quot;]"><pre class="notranslate"><code class="notranslate">Unable to execute SELECT statement [SELECT (...) FROM twilio_number WHERE twilio_number.id IN (:p1)] [wrapped: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: ""]
</code></pre></div>
<p dir="auto">the code below (for propel bridge) seems to do the trick, but I'm not sure if I can create PR for the Propel1Bridge repository. Will appreciate any help.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class ModelChoiceList extends ObjectChoiceList

    public function getChoicesForValues(array $values)
    {
        if (empty($values) || empty($first = reset($values))) {
            return array();
        }"><pre class="notranslate"><code class="notranslate">class ModelChoiceList extends ObjectChoiceList

    public function getChoicesForValues(array $values)
    {
        if (empty($values) || empty($first = reset($values))) {
            return array();
        }
</code></pre></div>