src/FormHandler.php
public function saveToAndGetClonedEntities()
    {
        $data = $this->transformFromFormData($this->data);

        $cloned_entities = array();
        foreach ($this->entities as $entity) {
            $entity['entity'] = clone $entity['entity'];
            $cloned_entities[] = $entity;

            if ($entity['entity'] instanceof EntityInterface) {
                $entity['entity']->setFormData($data, $entity['fields']);
            } else {
                $this->entityProcessor->saveToEntity($entity['entity'], $data, $entity['fields']);
            }
        }

        return $cloned_entities;
    }
public function saveToAndGetClonedEntities()
    {
        $data = $this->transformFromFormData($this->data);

        $cloned_entities = array();
        foreach ($this->entities as $entity) {
            $entity['entity'] = clone $entity['entity'];
            $cloned_entities[] = $entity;

            if ($entity['entity'] instanceof EntityInterface) {
                $entity['entity']->setFormData($data, $entity['fields']);
            } else {
                $this->entityProcessor->saveToEntity($entity['entity'], $data, $entity['fields']);
            }
        }

        return $cloned_entities;
    }
public function saveToAndGetClonedEntities ( ) { $ data = $ this -> transformFromFormData ( $ this -> data ) ; $ cloned_entities = array ( ) ; foreach ( $ this -> entities as $ entity ) { $ entity [ 'entity' ] = clone $ entity [ 'entity' ] ; $ cloned_entities [ ] = $ entity ; if ( $ entity [ 'entity' ] instanceof EntityInterface ) { $ entity [ 'entity' ] -> setFormData ( $ data , $ entity [ 'fields' ] ) ; } else { $ this -> entityProcessor -> saveToEntity ( $ entity [ 'entity' ] , $ data , $ entity [ 'fields' ] ) ; } } return $ cloned_entities ; }
Save the form data to cloned entities and retrieve them.

Useful for getting entities with the data assigned without affecting
the original entities

@return array
Save the form data to cloned entities and retrieve them .