Reputation: 801
I'm using Symfony 2.1
for a project. i use FOSUser Bundle
for managing users & customize it for my application. now i want to use SonataAdmin Bundle
for administration usage.
it works fine for normal entities (I can do the usual CRUD things) but for users, I get a user list & link in the dashboard but when I follow create new or click to edit, I get a 500 server error saying
"Class does not exist"
I don't want to use SonataUser Bundle
because i did lot's of customization on my userBundle & i don't want to loose them..
any idea?any example? Thanks for your helps :)
related codes:
in config.yml :
services:
sonata.admin.user:
class: Acme\AdminBundle\Admin\UserAdmin
arguments: [null, Acme\GeneralModelBundle\Entity\User, SonataAdminBundle:CRUD]
calls:
- [setUserManager, ["@fos_user.user_manager"]]
tags:
- {name: sonata.admin , manager_type: orm, group: Users, label: User}
Upvotes: 3
Views: 2055
Reputation: 801
finally i found the problem!! in Sonata Admin documentation it had an example for UserAdmin which i used,in this example it adds groups in configureFormFields function which is not enabled by default in FOSUser Bundle.. so when i comment that line every thing goes well!! :))
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->with('General')
->add('username')
->add('email')
->add('plainPassword', 'text')
->end()
/*******************************************************************
->with('Groups')
->add('groups', 'sonata_type_model', array('required' => false))
->end()
******************************************************************/
->with('Management')
->add('roles', 'sonata_security_roles', array( 'multiple' => true))
->add('locked', null, array('required' => false))
->add('expired', null, array('required' => false))
->add('enabled', null, array('required' => false))
->add('credentialsExpired', null, array('required' => false))
->end()
;
}
Upvotes: 5