1

I'm trying to install SonataUserBundle so I followed documentation (& use EasyExtendBundle but I get this error:

[Symfony\Component\Debug\Exception\FatalErrorException]                                              
  Error: Class Sonata\UserBundle\Entity\BaseUser contains 35 abstract methods and must therefore be declared abstract
   or implement the remaining methods (FOS\UserBundle\Model\UserInterface::setUsername, FOS\UserBundle\Model\UserInte
  rface::getUsernameCanonical, FOS\UserBundle\Model\UserInterface::setUsernameCanonical, ...) 

I did not change anything from the User entity generated by EasyExtends...

Config looks good:

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: Application\Sonata\UserBundle\Entity\User
    group:
        group_class: Application\Sonata\UserBundle\Entity\Group 
        group_manager: sonata.user.orm.group_manager
    service:
        user_manager: sonata.user.orm.user_manager

My composer:

"symfony/symfony": "2.8.*",
...
"friendsofsymfony/user-bundle": "~1.3",
"sonata-project/admin-bundle": "~2.2",
"sonata-project/doctrine-orm-admin-bundle": "~2.3",
"sonata-project/user-bundle": "^2.2",

Did someone have a solution for this?

Thanks for help!

CyrilleGuimezanes
  • 1,598
  • 1
  • 18
  • 33

3 Answers3

0

the configuration for fos_user is wrong... you must use the Sonata namespace entity ... not the generated one in the Application namespace

fos_user:
    db_driver:      orm # can be orm or odm
    firewall_name:  main
    user_class:     Sonata\UserBundle\Entity\BaseUser


group:
    group_class:   Sonata\UserBundle\Entity\BaseGroup

notice the user_class and the group_class reference the BaseEntity Sonata Docs

Drmjo
  • 584
  • 1
  • 5
  • 21
0

I finally start from a new project and use the https://github.com/sonata-project/sandbox as base (My project will use some other sonata projects)

So, probably a misconfiguration...

CyrilleGuimezanes
  • 1,598
  • 1
  • 18
  • 33
0

I guess it is a version issue between sonata and friendsofsymfony. My composer.json is like this

"sonata-project/easy-extends-bundle": "^2.1",
"sonata-project/user-bundle": "^2.2"
"friendsofsymfony/user-bundle": "^1.3",
"friendsofsymfony/jsrouting-bundle": "^1.6"

Maybe if we can have matching versions…

Ophiuchus
  • 515
  • 7
  • 17