Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Using ChoiceFilterType generate: Undefined constant Doctrine\DBAL\Types\Type::STRING #353

Open
AizeLeOuf opened this issue Nov 5, 2021 · 1 comment

Comments

@AizeLeOuf
Copy link

AizeLeOuf commented Nov 5, 2021

Hi everyone,

First of all, many thanks for all the work done in this bundle.

here my issue:

In my entity:

    /**
     * @ORM\Column(type="boolean")
     */
    private $state;

In my form:

$builder->add('state', Filters\ChoiceFilterType::class, [
            'choices'  => [
                'Validated' => true,
                'To validate' => false,
            ],
        ]);

In my controller:

if ($form->isSubmitted() && $form->isValid()) {
            $queryBuilder->addFilterConditions($form, $filterBuilder);
        }

This code generate:

Undefined constant Doctrine\DBAL\Types\Type::STRING

when I submit the form with a valid value (select 'Validated' or 'To Validated'). With null it's ok... Any help on it will be great !

Regards,

@gilles-g
Copy link
Member

gilles-g commented Nov 25, 2021

Hi,

I think it's because of your DBAL version...

Since they include a lot of BC, you need to update to DBAL v3

Two solutions:

  • update your composer.json to allow dbal 3.*
  • or use tag v6.* of the bundle, this tag use doctrine/orm 2.9, and orm 2.9 use dbal < 3

But I think I need to add in the composer.json of the bundle a deps with DBAL 3.* 🤔

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants