Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[DoctrineBridge] Warning : undefined array key 0 in DoctrineLoader when using UniqueEntity constraint  #57396

Copy link
Copy link
Closed
@partulaj

Description

@partulaj
Issue body actions

Symfony version(s) affected

7.1

Description

Hello,
When trying to upgrade to symfony 7.1 I get the following error.

!!  In DoctrineLoader.php line 129:
!!                                    
!!    Warning: Undefined array key 0 

After taking a look in the code the problem seems to be due to one of my entity validation constraints having a UniqueEntity constraint set like this :

App\Entity\User:
    constraints:
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity: email

But if I define the constraint like below I don't get the warning :

App\Entity\User:
    constraints:
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
              fields: ['email']

How to reproduce

Add a UniqueEntity constraint without using the fields option and try to validate your entity

App\Entity\User:
    constraints:
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity: email

Possible Solution

No response

Additional Context

No response

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.