8000 [form] error when submitting empty value in for using model choice list · Issue #14583 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[form] error when submitting empty value in for using model choice list #14583
Closed
@piogrek

Description

@piogrek

I think that's happening only on propel + postgres after @webmozart removed empty/null checks from ChoiceToValueTransformer in 1d89922

ModelChoiceList->getChoicesForValues allows to create Propel query with empty string values which are not accepted, so I'm getting:

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: ""]

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.

class ModelChoiceList extends ObjectChoiceList

    public function getChoicesForValues(array $values)
    {
        if (empty($values) || empty($first = reset($values))) {
            return array();
        }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0