8000 Field of type entity does not support null value · Issue #14856 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Field of type entity does not support null value #14856

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

Closed
rmpIGN opened this issue Jun 4, 2015 · 2 comments
Closed

Field of type entity does not support null value #14856

rmpIGN opened this issue Jun 4, 2015 · 2 comments

Comments

@rmpIGN
Copy link
rmpIGN commented Jun 4, 2015

In Symfony 2.7 only, works fine in 2.6.*

$builder->add('typeVoie', 'entity', array(
                'class' => 'MyBundle:TypeVoie',
                'query_builder' => function(EntityRepository $er) {
                    return $er->createQueryBuilder('u')
                    ->orderBy('u.weight', 'DESC');
                },
                'property' => 'typeVoieLower',
                'label' => 'Type de voie',
                'label_attr' => array('id' => 'label_typevoie'),
                'required' => false
)

Despite the option required => false the form does not accept null values and returns

SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: ""

The entity definition has the option nullable=true set on this field.

Thanks

@phansys
Copy link
Contributor
phansys commented Jun 5, 2015

I think it's a duplicated of #14583.

@xabbuh
Copy link
Member
xabbuh commented Jun 6, 2015

closing as a duplicate of #14583

@xabbuh xabbuh closed this as completed Jun 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0