Maslosoft Mangan Logo Maslosoft Mangan Documentation
MongoDB Object Persister

Edit

Traits

Mangan comes with various trait's for easier implementation of common cases

Class Name Documentation
AspectsTrait

Use this trait for easy implementation of AspectsInterface

AvailableCommands

AvailableCommands

CollectionNameTrait

This trait contains default getCollectionName implementation. It will first try to get collection name from annotations, then it will fall back to current class name with slashes renamed to dots.

Example auto generated collection name for class \ManganExamples\Model\User:

ManganExamples.Model.User
CriteriaAwareTrait

The most simple Criteria Aware Interface implementation.

EntityManagerTrait

This trait contains same methods as EntityManagerInterface, and it forwards them to concrete Entity Manager class. Entity manager used by this trait can be defined via EntityManager annotation.

This is useful to create Active Document pattern classes.

FinderTrait

Finder trait contains implementation of FinderInterface, and it forwards them to concrete Finder class. Finder used by this trait can be defined via Finder annotation.

This trait could be used as a part of active document class.

I18NAbleTrait

I18N-able trait contains basic implementation of I18N feature. This covers methods from InternationalInterface.

Use this trait to provide internationalized columns for models.

ModelAwareTrait

ModelAwareTrait

NameAwareTrait

Basic implementation of Name Aware Interface

OwneredTrait

This trait provides basic implemention on ownering of documents. This allows sub-document to get it's parent or root document.

When using this trait, it is recommended that all classes in composition to implement OwneredInterface or use this trait.

NOTE: Currently it's implementation does not work instantly. Owner is set when transforming objects, which include save/load.

ScenariosTrait

This trait provides implementation of scenarios feature. It works with ScenarioManager, but only if class using it also implements ScenariosInterface.

Use this to enchance models with scenarios, this allows triggering different validators depending on scenario, or to be used with any custom feature.

SortAwareTrait

SortAwareTrait

ValidatableTrait

Validatable trait adds methods for validating model. These are not nessesary to validate, but might be more convenient to validate model by it's own method.

Class using this trait should implement ValidatableInterface.

WithCriteriaTrait

Attach criteria to model