public function UserEntityClone::cloneEntity in Entity Clone 8
Clone an entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity.
\Drupal\Core\Entity\EntityInterface $cloned_entity: The cloned entity.
array $properties: All new properties to replace old.
Return value
\Drupal\Core\Entity\EntityInterface The new saved entity.
Overrides ContentEntityCloneBase::cloneEntity
File
- src/
EntityClone/ Content/ UserEntityClone.php, line 15
Class
- UserEntityClone
- Class ContentEntityCloneBase.
Namespace
Drupal\entity_clone\EntityClone\ContentCode
public function cloneEntity(EntityInterface $entity, EntityInterface $cloned_entity, array $properties = [], array &$already_cloned = []) {
/** @var \Drupal\user\UserInterface $cloned_entity */
$cloned_entity
->set('name', $cloned_entity
->getAccountName() . '_cloned');
return parent::cloneEntity($entity, $cloned_entity, $properties);
}