spiral / framework

High-Performance PHP Framework
https://spiral.dev
MIT License
1.75k stars 84 forks source link

MongoDB ODM #1081

Open DiasIshbulatov10 opened 4 months ago

DiasIshbulatov10 commented 4 months ago

I have to build Web app using Spiral framework with mongoDB. Is MongoDB ODM engine provided in the latest version of spiral framework or not?(v3.11) As my hearing, this feature don't support in the latest framework version. How can I integrate MongoDB with spiral framework? Thank you.

roxblnfk commented 4 months ago

We have frozen support for our own ODM. However, you can take any MongoDB integration and integrate it with the framework through bootloaders.

DiasIshbulatov10 commented 4 months ago

Thank you for your reply. Could you help me to integrate MongoDB ODM with the framework? I need a more detailed description. I hope you can help me.

wolfy-j commented 4 months ago

The MondoDB native ODM currently not maintained since we focused on Cycle ORM and modern DB can handle json. You can file a ticket and ask for ODM update, any donation or more community likes will prioritize this feature.

As for now I would recommend looking to Doctrine ODM - https://github.com/doctrine/mongodb-odm

It should be on part with ODM that used to be part of Spiral in the past.

DiasIshbulatov10 commented 4 months ago

how can i file a ticket and ask for ODM update?

DiasIshbulatov10 commented 4 months ago

Hi, wolfy-j. I hope you can help. I want to integrate mongoDB-odm to spiral framework v3.11. How can I do that?

wolfy-j commented 4 months ago

Hi!

It depends if you are willing to use existing ODM (such as Doctrine) - in this case you only have to write a bootloader and probably finalized (if it uses any sort of heap).

Or, if you want to do something more fun and create ODM based on what we had before: https://github.com/wolfy-j/lodm

I would recommend option one, in this case you have to check how to launch Doctrine ODM in standalone mode (it will tell you what has to be bootloader). You can probably also check some Laravel integrations, their service providers are quite similar to bootloaders and copy it. That's about it.

DiasIshbulatov10 commented 4 months ago

Hi, I want to use doctrine-mongo-odm in spiral framework. how can i config it to start when server start and use easily.

wolfy-j commented 4 months ago

I just described it above :) you create a bootloader and provide DI for it. There are nothing special about it. If you having issues - starts with simple controller work ODM init first.