0
votes

I'm struggling with doctrine 2 mongodb references _doctrine_class_name.

I have to change namespace of many doctrine entities but after all I can't use my mongo db because _doctrine_class_name was not changed in documents.

That's the code of doctrine document:

namespace Test\EditorBundle\Document;//was Editor\Bundle\Document;
class Issue{
/*.....................*/
  /** @ODM\ReferenceOne() */
  protected $publisher;
/*.....................*/
}

After namespace changing I got class not found error. There are multiple classes that could be referenced to.

How do I change all class annotations? May be some replace at mongodb?

1

1 Answers

0
votes

You could specify discriminatorMap for the reference field and translate old FQCNs to their new counterparts.

Alternatively you may just update publisher._doctrine_class_name in the database to reflect changed namespaces.