/** * Initializes a new DocumentPersister instance. * * @param PersistenceBuilder $pb * @param DocumentManager $dm * @param EventManager $evm * @param UnitOfWork $uow * @param HydratorFactory $hydratorFactory * @param ClassMetadata $class */ public function __construct(PersistenceBuilder $pb, DocumentManager $dm, EventManager $evm, UnitOfWork $uow, HydratorFactory $hydratorFactory, ClassMetadata $class, CriteriaMerger $cm = null) { $this->pb = $pb; $this->dm = $dm; $this->evm = $evm; $this->cm = $cm ?: new CriteriaMerger(); $this->uow = $uow; $this->hydratorFactory = $hydratorFactory; $this->class = $class; $this->collection = $dm->getDocumentCollection($class->name); $this->cp = $this->uow->getCollectionPersister(); }