class Cloner implements ApplicationAwareInterface (View source)

Class to clone express entities.

Traits

Trait ApplicationAwareTrait A trait used with ApplicationAwareInterface

Properties

protected Application $app from  ApplicationAwareTrait
private EntityHandleGenerator $entityHandleGenerator
private EntityManagerInterface $entityManager

Methods

setApplication(Application $app)

Setter method for the application

__construct(EntityHandleGenerator $entityHandleGenerator, EntityManagerInterface $entityManager)

Cloner constructor.

cloneEntity(Entity $entity, array $controlsMapping = [])

Duplicate Express Entity and return the newly created Entity.

array
cloneEntityAttributes(Entity $sourceEntity, Entity $destinationEntity)

Clone Entity Attributes

array
cloneEntityAssociations(Entity $sourceEntity, Entity $destinationEntity)

Clone Entity Associations

void
cloneEntityForms(Entity $sourceEntity, Entity $destinationEntity, array $akMapping, array $associationMapping, array $controlsMapping = [])

Clone Entity Forms

Details

setApplication(Application $app)

Setter method for the application

Parameters

Application $app

__construct(EntityHandleGenerator $entityHandleGenerator, EntityManagerInterface $entityManager)

Cloner constructor.

Parameters

EntityHandleGenerator $entityHandleGenerator
EntityManagerInterface $entityManager

Entity cloneEntity(Entity $entity, array $controlsMapping = [])

Duplicate Express Entity and return the newly created Entity.

Parameters

Entity $entity

to be cloned

array $controlsMapping

(Optional) Map old form controls ID's to new ones [oldFormControlID => newFormControlID]

Return Value

Entity

cloned entity

protected array cloneEntityAttributes(Entity $sourceEntity, Entity $destinationEntity)

Clone Entity Attributes

Parameters

Entity $sourceEntity
Entity $destinationEntity

Return Value

array

Return attribute key handle mapping [sourceKeyHandle => $newKey]

protected array cloneEntityAssociations(Entity $sourceEntity, Entity $destinationEntity)

Clone Entity Associations

Parameters

Entity $sourceEntity
Entity $destinationEntity

Return Value

array

Return association mapping [sourceAssociationId => newAssociation]

protected void cloneEntityForms(Entity $sourceEntity, Entity $destinationEntity, array $akMapping, array $associationMapping, array $controlsMapping = [])

Clone Entity Forms

Parameters

Entity $sourceEntity
Entity $destinationEntity
array $akMapping

attribute key mapping [sourceKeyHandle => newKey]

array $associationMapping

attribute key mapping [sourceAssociationId => newAssociation]

array $controlsMapping

(Optional) Map old form controls ID's to new ones [oldFormControlID => newFormControlID]

Return Value

void