I have a problem with a PersistentCollection.
I have an Object User (herited of FOSUserbundle user class) who have an EmdebedDocument Seance. The Seance have an Array of Event. My Seance Class:
/**
* @MongoDB\EmbeddedDocument
*/
class Seance
{
/**
* @MongoDB\Id
*/
protected $id;
/**
* @MongoDB\EmbedMany(targetDocument="Event")
*/
protected $dispos ;
/**
* @MongoDB\Field(type="string")
*/
protected $rayonDeplacement;
/**
* @MongoDB\Field(type="string")
*/
protected $lieu;
/**
* @MongoDB\Field(type="string")
*/
protected $prix;
/**
* @MongoDB\Field(type="string")
*/
protected $nbPersonne;
And my class Event
/**
* @MongoDB\EmbeddedDocument
*/
class Event extends BaseEvent
{
/**
* @var integer
* @MongoDB\Id
*/
protected $id;
/**
* @var \DateTime
* @MongoDB\Field(type="date")
* @Assert\NotNull()
*/
protected $startDate;
/**
* @var \DateTime
* @MongoDB\Field(type="date")
* @Assert\NotNull()
*/
protected $endDate;
I give the event from user with:
$user->getSeance()->getDispos()
This function returns a empty PersistentCollection while they are events in database.
When dump the return of getDispos() method I have:
I dont't understant why I have mongoData field with my data but arrayCollection empty.
Thank you for yout help.