[Fixed] MongoDB ODM Annotation export ignores "db" setting for collections

0 votes
asked Jan 3, 2017 in Solved by Mario (190 points)
recategorized Jan 4, 2017 by ludek.vodicka

When exporting a MongoDB ODM model without Framework support, the "db" property is not written to the exported file, and if present in the file (by manually setting it) removed.

Version: 3.2.7.1338

2 Answers

0 votes
answered Jan 3, 2017 by ludek.vodicka Skipper developer (140,450 points)

You can't export ODM model without Framework support. For Mongo ODB you need to have configured framework as Mongo ODM.

In case the problem is somewhere else, please post more details, some test project where this issue can be replicated

commented Jan 3, 2017 by Mario (190 points)

I selected No MVC Framework. Which appears to work fine for exporting. The only issue I am running into is that the 'db' property is ignored.

If you create a new file, select MongoDB ODM and No MVC Framework, used default entity created by Skipper, set the 'db' property and export it to Doctrine Annotations, the 'db' property will be @ODM\Document not * @ODM\Document(db="mydb")

Check your email for code sample :)

commented Jan 3, 2017 by ludek.vodicka Skipper developer (140,450 points)

Oh, ok. I wrongly understood "framework" as ORM framework. You're right that MVC doesn't make a difference in this case.

Thanks for the explanation. We will check it tomorrow and let you know.

0 votes
answered Jan 4, 2017 by ludek.vodicka Skipper developer (140,450 points)
commented Jan 4, 2017 by Mario (190 points)

Thanks it works. However there is a follow up issue with it when using inheritance via Mapped Superclass as it will also add the 'db' property to the parent and cause:

Unknown property 'db' on annotation 'Doctrine\ODM\MongoDB\Mapping\Annotations\MappedSuperclass
commented Jan 4, 2017 by ludek.vodicka Skipper developer (140,450 points)

Thanks for report. Can you please send me testing project to [email protected] so we can test it and fix it right now? Thanks

commented Jan 4, 2017 by Mario (190 points)

Never mind, I apologize, the issue was mine having created a workaround until you fixed the original issue earlier.

commented Jan 4, 2017 by ludek.vodicka Skipper developer (140,450 points)

No problem, I'm glad it's working now.

...