src/Graviton/RestBundle/Model/DocumentModel.php
private function dispatchModelEvent($action, $collection)
    {
        if (!($this->repository instanceof DocumentRepository)) {
            return;
        }
        if (!method_exists($collection, 'getId')) {
            return;
        }

        $event = new ModelEvent();
        $event->setCollectionId($collection->getId());
        $event->setActionByDispatchName($action);
        $event->setCollectionName($this->repository->getClassMetadata()->getCollection());
        $event->setCollectionClass($this->repository->getClassName());
        $event->setCollection($collection);

        $this->eventDispatcher->dispatch($action, $event);
    }
private function dispatchModelEvent($action, $collection)
    {
        if (!($this->repository instanceof DocumentRepository)) {
            return;
        }
        if (!method_exists($collection, 'getId')) {
            return;
        }

        $event = new ModelEvent();
        $event->setCollectionId($collection->getId());
        $event->setActionByDispatchName($action);
        $event->setCollectionName($this->repository->getClassMetadata()->getCollection());
        $event->setCollectionClass($this->repository->getClassName());
        $event->setCollection($collection);

        $this->eventDispatcher->dispatch($action, $event);
    }
private function dispatchModelEvent ( $ action , $ collection ) { if ( ! ( $ this -> repository instanceof DocumentRepository ) ) { return ; } if ( ! method_exists ( $ collection , 'getId' ) ) { return ; } $ event = new ModelEvent ( ) ; $ event -> setCollectionId ( $ collection -> getId ( ) ) ; $ event -> setActionByDispatchName ( $ action ) ; $ event -> setCollectionName ( $ this -> repository -> getClassMetadata ( ) -> getCollection ( ) ) ; $ event -> setCollectionClass ( $ this -> repository -> getClassName ( ) ) ; $ event -> setCollection ( $ collection ) ; $ this -> eventDispatcher -> dispatch ( $ action , $ event ) ; }
Will fire a ModelEvent

@param string $action     insert or update
@param Object $collection the changed Document

@return void
Will fire a ModelEvent