Problem/Motivation

Current date when cloning an entity is only applied to the cloned entity, not the automatically cloned translation.

Steps to reproduce

Clone a node that has a translation and was created by a different date
Result: The original cloned node has the current date as created date, the cloned translation has the original date as created date.

Both are expected to be set by the current date!

Proposed resolution

Also set the current date on the cloned translation.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

n.ghunaim created an issue. See original summary.

n.ghunaim’s picture

StatusFileSize
new1014 bytes
n.ghunaim’s picture

Assigned: n.ghunaim » Unassigned
Status: Active » Needs review

n.ghunaim’s picture

StatusFileSize
new1 KB

Fix the comment message.

sinn’s picture

Patch solves the issue - with the patch all translations are created using the current time.

Would be nice to have a test.

And small improvement can be applied to have the same time for all translations

     $current_time = $this->timeService->getRequestTime();
      foreach ($languages as $langcode => $language) {
        $translation = $cloned_entity->getTranslation($langcode);
       $translation->setCreatedTime($current_time);
      }
sinn’s picture

rajeshreeputra’s picture

Status: Needs review » Closed (works as designed)