FOSUserBundle: Possible Problems With Symfony 4.3

Symfony FOSUserBundle versions: v2.1.0

Description of the problem including expected versus actual behavior: When attempting to reference the user entity that extends the model, you get validation errors in the upcoming Symfony 4.3 from the validator. It complains about not having the field superAdmin, (and if you add a fake superAdmin field) it then won’t get past the group methods. I haven’t experienced these issues with 4.2, and didn’t experience them in 4.3 before attempting to actually reference and use the user entity. I assume this is related to the new Doctrine validation that is being introduced in Symfony 4.3, but I’m not sure how to disable this functionality for the class as they said that is “coming soon”. Has anyone else noticed this issue, or am I missing something simple?

Steps to reproduce:

  1. Install the FOSUserBundle on a beta build of Symfony 4.3
  2. Attempt to call the user entity via Twig such that the new Doctrine validator kicks in

Provide logs (if relevant): Property “superAdmin” does not exist in class “App\Entity\User”

Update: I forked to attempt to see if I could get around the problem, and I was able to by renaming some key methods (I’m not submitting this as a pull request because that clearly isn’t an acceptable long-term solution). Renaming isSuperAdmin() and setSuperAdmin to userIsSuperAdmin() and userSetSuperAdmin(), and hasGroup() to userHasGroup() does at least get rid of the errors.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 18 (1 by maintainers)

Commits related to this issue

Most upvoted comments

@richard4339 I found this Symfony issue. It might be a bug. Let’s see how it progresses. In meanwhile we keep searching to see and understand what exactly changed with the update to Symfony 4.3.0

Me to i have the same problem!

Any progress on this issue? We’re waiting to upgrade, but am holding back until this is resolved.

Same problem

Update: Solved with adding variables to src/Entity/User.php

private $superAdmin;
private $group;

@GinesGarcia i think you should use “constraints” instead of “mapping” annotation for your validation… idk.

Have the same problem. Commented next lines and it works for me:

framework:
    validation:
#        auto_mapping:
#            App\Entity\: []

Works for me, but this disable entity validation for all entities

Have the same problem. Commented next lines and it works for me:

framework:
    validation:
#        auto_mapping:
#            App\Entity\: []

I tried with Symfony 4.3.1 and also tried with FOS version 2.1.0. Still having the same problem. After that I have to use lower version of Symfony 4.2 and it works fine with FOS.

@richard4339 stay confident. It is the new Symfony Validator. I get the same error with a different bundle when my Entity class extends another abstract class. Searching for a fix…