trait DuplicatableModelTrait

Trait DuplicatableModelTrait

Methods

duplicate(array $overwriteProperties = [], DuplicatableInterface|null $targetModel = null)

Duplicate Model and associated content This function will replicate the current model and its associated content:

  • Referenced Documents will be referenced by passive or read reference
  • Tags will be copied

array
getNonDuplicatableFields(array $ignoredFieldsByDefault = [])

No description

mixed|string
getUniquePropertyValue($propertyId, $propertyValue)

Helper Function to iterate over existing field values to ensure a valid name. a "_ID" with an increasing ID will be appended if the value already exists

bool
isReferenceDuplicationAllowed()

Should reference items be duplicated (deep copy of dms objects) If false (default), references will be replicated as shallow read references to their original items

void
onDuplicateProperties(Model $duplicate)

No description

void
onDuplicateSaved(Model $duplicate)

No description

void
onReferencesDuplicated(array $referenceMap = [])

No description

Details

at line 33
Model duplicate(array $overwriteProperties = [], DuplicatableInterface|null $targetModel = null)

Duplicate Model and associated content This function will replicate the current model and its associated content:

  • Referenced Documents will be referenced by passive or read reference
  • Tags will be copied

Parameters

array $overwriteProperties ['group_id'=>'new_group_id']
DuplicatableInterface|null $targetModel

The passed model to duplicate all properties onto. Only superclasses from $this are allowed - a System DMS document could never be copied into another DMS instance, only the other way around (DMS to System DMS).

Return Value

Model

See also

DuplicatableInterface

at line 190
array getNonDuplicatableFields(array $ignoredFieldsByDefault = [])

No description

Parameters

array $ignoredFieldsByDefault

Contains the default fields which will be ignored for your model, based on the database schema

Return Value

array

Fields that you do not want copied,

at line 112
mixed|string getUniquePropertyValue($propertyId, $propertyValue)

Helper Function to iterate over existing field values to ensure a valid name. a "_ID" with an increasing ID will be appended if the value already exists

Parameters

$propertyId
$propertyValue

Return Value

mixed|string

at line 199
protected bool isReferenceDuplicationAllowed()

Should reference items be duplicated (deep copy of dms objects) If false (default), references will be replicated as shallow read references to their original items

Return Value

bool

at line 206
protected void onDuplicateProperties(Model $duplicate)

No description

Parameters

Model $duplicate

Return Value

void

at line 213
protected void onDuplicateSaved(Model $duplicate)

No description

Parameters

Model $duplicate

Return Value

void

at line 217
protected void onReferencesDuplicated(array $referenceMap = [])

No description

Parameters

array $referenceMap

Return Value

void