/** * {@inheritdoc} */ public function cloneEntity(EntityInterface $entity, EntityInterface $cloned_entity, $properties = []) { /** @var \Drupal\file\FileInterface $cloned_entity */ $cloned_file = file_copy($cloned_entity, $cloned_entity->getFileUri(), FILE_EXISTS_RENAME); return parent::cloneEntity($entity, $cloned_file, $properties); }
/** * {@inheritdoc} */ public function cloneEntity(EntityInterface $entity, EntityInterface $cloned_entity, $properties = []) { /** @var \Drupal\user\UserInterface $cloned_entity */ $cloned_entity->set('name', $cloned_entity->getAccountName() . '_cloned'); return parent::cloneEntity($entity, $cloned_entity, $properties); }