Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Some ODM Questions

HI all I would like to use an ODM (surely mongoDB) database and would like some things to be clarified.

Firstly, Is the doc page is up to date to develop ODM collections with php7 (with the mongo class deletion) ? I saw somewhere I'll need to include the incubator, is it still true, or the new class from incubator are now in phalcon ?

I have some questions about the "Model" too. I worked for a while with zend framework 2 and Doctrine ODM.

Is there anything equivalent to the doctrine annotation ? (to specify the field type, the filed name if needed, the relationship, if the field is an EmbedDocument, etc.)

How are managed relationships between collections ? (didn't see anything about this in the ODM doc page)

How are managed EmbedCollection ?

For the default "_id" field, do I have to name a field $_id in my collection PHP class to access it ?

I think I saw that the id field is included in MongoCollection Class but I would like a confirmation.

Thanks in advance for the answer.

edited 18d ago

After some research and starting to change Model to Collection, I saw there is no relationships, no hasChanged function or things like that (that I need).

the ODM classes lacks on lot of features, that's sad. I'll wait some big update to that to change from SQL to NoSQL


Well, yes, ODM needs better support in Phalcon. But you can always develop your own implementation, following Phalcon's interfaces and perhaps even submit a PR with that code.


I'll think about that but actually, I haven't enought time to develop my personnal app, so I don't think I'll lose more time on this for now. As I said I'll keep up with SQL and maybe will work on ODM later.

My goal for my app is to share it with the most possible features, so add support for SQL and NoSQL. but NoSQL will wait a bit.

I'll fork the incubator to start thinking a bit about possible PR in the future though.