I'm having some problems updating a reference from one collection to another in Symfony2 with mongoDB using Sonata Admin Bundle.
I have created this reference between the users and the communities they can admin.
This one is in the Community class
class Community
{
/**
* @MongoDB\ReferenceMany(
* targetDocument="User",
* inversedBy="communitiesAdmin",
* )
*/
protected $usersAdministrator;
And this one in the User
class User extends BaseUser
{
/**
* @MongoDB\ReferenceMany(
* targetDocument="Community",
* mappedBy="usersAdministrator",
* )
*/
protected $communitiesAdmin;
and this is the way I show the field in Sonata
$formMapper
->with('Community Administrators')
->add('usersAdministrator', 'sonata_type_model', array('expanded' => true))
->end()
When i track the collection in MongoHub the reference is being created but I cannot update it because the data previously inserted is not being shown when I edit the community.
Any idea?