in my project i'm using a document "Question" which references (Many to another document "Category") after setting the Category of a question and flushing nothing changes in my database there is my code
$dm = $this->getDocumentManager();
$question = $this->getDocumentManager()->getRepository('ATS\QuizzBundle\Document\Question')->findOneByQuestion("a?");
$category = $this->getDocumentManager()->getRepository('ATS\QuizzBundle\Document\Category')->findOneByLabel("Logic");
$question->addCategory($category);
$dm->flush();
and there is no changes in my database, any one can help please ? and here is my mapping in the Question's Document :
/**
*@MongoDB\ReferenceMany(targetDocument="Category")
*/
protected $category