Skip to content
Snippets Groups Projects

Issue #3295076: Migrate rollback for translations doesn't work

2 unresolved threads

Merge request reports

Members who can merge are allowed to add commits.
Ready to merge by members who can write to the target branch.
  • The source branch is 18 commits behind the target branch.
  • 1 commit will be added to 8.x-1.x.
  • Source branch will not be deleted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
187 188 }
188 189 }
189 190 }
190 191 }
  • Comment on lines 173 to 190
    Suggested change
    173 protected function rollbackTranslation(array $destination_identifiers) {
    174 $revision_id = $destination_identifiers['revision_id'];
    175 $entity = $this->storage->loadRevision($revision_id);
    176 if ($entity && $entity instanceof TranslatableInterface) {
    177 if ($key = $this->getKey('langcode')) {
    178 if (isset($destination_identifiers[$key])) {
    179 $langcode = $destination_identifiers[$key];
    180 if ($entity->hasTranslation($langcode)) {
    181 // Make sure we don't remove the default translation.
    182 $translation = $entity->getTranslation($langcode);
    183 if (!$translation->isDefaultTranslation()) {
    184 $entity->removeTranslation($langcode);
    185 $entity->save();
    186 }
    187 }
    188 }
    189 }
    190 }
    191 }
    173 protected function rollbackTranslation(array $destination_identifiers) {
    174 if ($revision_id = $this->getKey('revision')) {
    175 $entity = $this->storage->loadRevision($revision_id);
    176 if ($entity && $entity instanceof TranslatableInterface) {
    177 if ($key = $this->getKey('langcode')) {
    178 if (isset($destination_identifiers[$key])) {
    179 $langcode = $destination_identifiers[$key];
    180 if ($entity->hasTranslation($langcode)) {
    181 // Make sure we don't remove the default translation.
    182 $translation = $entity->getTranslation($langcode);
    183 if (!$translation->isDefaultTranslation()) {
    184 $entity->removeTranslation($langcode);
    185 $entity->save();
    186 }
    187 }
    188 }
    189 }
    190 }
    191 }
    192 }
  • Please register or sign in to reply
  • 208 209 }
    209 210 }
    210 211
    211 212 }
    • Comment on lines 198 to 211
      Suggested change
      199 protected function rollbackNonTranslation(array $destination_identifiers) {
      200 $revision_id = $destination_identifiers['revision_id'];
      201 $entity = $this->storage->loadRevision($revision_id);
      202 if ($entity) {
      203 if ($entity->isDefaultRevision()) {
      204 $entity->delete();
      205 }
      206 else {
      207 $this->storage->deleteRevision($revision_id);
      208 }
      209 }
      210 }
      211
      212 }
      199 protected function rollbackNonTranslation(array $destination_identifiers) {
      200 if ($revision_id = $this->getKey('revision')) {
      201 $entity = $this->storage->loadRevision($revision_id);
      202 if ($entity) {
      203 if ($entity->isDefaultRevision()) {
      204 $entity->delete();
      205 }
      206 else {
      207 $this->storage->deleteRevision($revision_id);
      208 }
      209 }
      210 }
      211 }
      212 }
    • Please register or sign in to reply
    Please register or sign in to reply
    Loading