๐๏ธ Architecture
This guide explains how MikroORM works internally. It's intended for users who want a deeper understanding of the ORM's behavior, as well as contributors looking to understand the codebase.
๐๏ธ Entity Manager
Persist and Flush
๐๏ธ Unit of Work
MikroORM uses the Identity Map pattern to track objects. Whenever you fetch an object from the database, MikroORM will keep a reference to this object inside its UnitOfWork.
๐๏ธ Identity Map
MikroORM uses identity map in background, so you will always get the same instance of one entity.
๐๏ธ Transactions and Concurrency
Transactions are also supported in MongoDB driver.
๐๏ธ Entity Repository
Entity Repositories are thin layers on top of EntityManager. They act as an extension point, so you can add custom methods, or even alter the existing ones. The default EntityRepository implementation just forwards the calls to underlying EntityManager instance.
๐๏ธ Collections
OneToMany and ManyToMany properties are stored in a Collection wrapper.
๐๏ธ The wrap() Helper
The wrap() helper provides access to useful methods for working with entities. It returns a WrappedEntity instance that exposes methods for checking entity state, loading relations, serializing, and updating values.