Maslosoft Mangan Documentation
MongoDB Object Persister
Plain PHP Object
Mangan is capable of storing plain PHP objects. That means, that to manage
object state in MongoDB, model class can extend from any user provided class,
or non at all. Only requirement is to implement AnnotatedInterface
, as it is
required for parsing annotations. Using annotations allows
to separate storing logic from model code.
All Mangan features are available on either plain PHP objects, or when
using provided base class, for instance Document
.
The difference, is how those operations are performed. When working with plain objects, for each of operation kind there are separate classes:
- Validating objects:
Validator
. - Storing and removing objects:
EntityManager
. - Retrieving objects:
Finder
.
In contrast to this, pre-composed Document
class have all CRUD
methods built-in.
It is sole model developer whether he want to use active document approach or if he decides to use entity manager/finder/validator or any mix of those.