src/Controller/DefaultController.php
private function doCloneAction(ModelInterface $model)
    {
        $environment = $this->getEnvironment();

        // Make a duplicate.
        $clonedModel = $this->createClonedModel($model);

        // Trigger the pre duplicate event.
        $duplicateEvent = new PreDuplicateModelEvent($environment, $clonedModel, $model);
        $environment->getEventDispatcher()->dispatch($duplicateEvent::NAME, $duplicateEvent);

        // And trigger the post event for it.
        $duplicateEvent = new PostDuplicateModelEvent($environment, $clonedModel, $model);
        $environment->getEventDispatcher()->dispatch($duplicateEvent::NAME, $duplicateEvent);

        return $clonedModel;
    }
private function doCloneAction(ModelInterface $model)
    {
        $environment = $this->getEnvironment();

        // Make a duplicate.
        $clonedModel = $this->createClonedModel($model);

        // Trigger the pre duplicate event.
        $duplicateEvent = new PreDuplicateModelEvent($environment, $clonedModel, $model);
        $environment->getEventDispatcher()->dispatch($duplicateEvent::NAME, $duplicateEvent);

        // And trigger the post event for it.
        $duplicateEvent = new PostDuplicateModelEvent($environment, $clonedModel, $model);
        $environment->getEventDispatcher()->dispatch($duplicateEvent::NAME, $duplicateEvent);

        return $clonedModel;
    }
private function doCloneAction ( ModelInterface $ model ) { $ environment = $ this -> getEnvironment ( ) ; // Make a duplicate. $ clonedModel = $ this -> createClonedModel ( $ model ) ; // Trigger the pre duplicate event. $ duplicateEvent = new PreDuplicateModelEvent ( $ environment , $ clonedModel , $ model ) ; $ environment -> getEventDispatcher ( ) -> dispatch ( $ duplicateEvent :: NAME , $ duplicateEvent ) ; // And trigger the post event for it. $ duplicateEvent = new PostDuplicateModelEvent ( $ environment , $ clonedModel , $ model ) ; $ environment -> getEventDispatcher ( ) -> dispatch ( $ duplicateEvent :: NAME , $ duplicateEvent ) ; return $ clonedModel ; }
Effectively do the clone action on the model.

@param ModelInterface $model The model to clone.

@return ModelInterface Return the cloned model.
Effectively do the clone action on the model .