Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages in full color showing how to combine Symfony with Docker, APIs, queues & async tasks, Webpack, Single-Page Applications, etc.

Buy printed version

DoctrineMongoDBBundle

DoctrineMongoDBBundle

The MongoDB Object Document Mapper (ODM) is much like the Doctrine2 ORM in its philosophy and how it works. In other words, like the Doctrine2 ORM, with the Doctrine ODM, you deal only with plain PHP objects, which are then persisted transparently to and from MongoDB.

Tip

You can read more about the Doctrine MongoDB ODM via the project’s documentation.

The bundle integrates the Doctrine MongoDB ODM into Symfony, helping you to configure and use it in your application.

Note

This documentation will feel a lot like the Doctrine2 ORM chapter, which talks about how the Doctrine ORM can be used to persist data to relational databases (e.g. MySQL). This is on purpose - whether you persist to a relational database via the ORM or to MongoDB via the ODM, the philosophies are very much the same.

Doctrine Extensions: Timestampable, Sluggable, etc.

Doctrine is quite flexible, and a number of third-party extensions are available that allow you to perform repeated and common tasks on your entities. These include things such as Sluggable, Timestampable, Loggable, Translatable, and Tree.

For more information about them, see available Doctrine extensions and use the StofDoctrineExtensionsBundle to integrate them in your application.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.