I'm trying to extend the User Entity of the sonata user bundle, but it always fails (at least when I want to use ist with the sonata admin bundle). If I use the Application/Sonata/UserBundle/Entity/User Entity it works and I can edit it in the dashboard.
My Entity looks like this:
<?php
namespace MyNamespace\MyBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\EntityManager;
use Sonata\UserBundle\Entity\BaseUser as BaseUser;
/**
* @ORM\Entity
* @ORM\Table(name="fos_user")
*/
class User extends BaseUser
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
}
In my config.yml I defined the following options:
fos_user:
db_driver: orm
firewall_name: main
user_class: MyNamespace\MyBundle\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
And:
sonata_user:
security_acl: true
manager_type: orm
class:
user: MyNamespace\MyBundle\Entity\User
The login is working correctly, but then I get the error message
"An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "admin_sonata_user_user_create" as such route does not exist.") in SonataAdminBundle:Block:block_admin_list.html.twig at line 39."
My routing.yml looks like this:
admin:
resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: /
_sonata_admin:
host: www.mydomain.com
resource: .
type: sonata_admin
prefix: /
schemes: [https]
Even if I follow this tutorial (Extending Sonata User Bundle and adding new fields) step by step I get the same error.