From 3eaa7fd7c1dfa3d7b9bf6493e380f8232e370808 Mon Sep 17 00:00:00 2001 From: roadiz-ci Date: Thu, 13 Feb 2025 09:44:46 +0000 Subject: [PATCH] Merge tag v2.4.14 into develop --- migrations/Version20250213093448.php | 29 ++++++++++++++++++++++++++++ src/Entity/NodesSources.php | 16 +++++++++++++++ src/Node/NodeTranstyper.php | 2 +- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 migrations/Version20250213093448.php diff --git a/migrations/Version20250213093448.php b/migrations/Version20250213093448.php new file mode 100644 index 00000000..053af711 --- /dev/null +++ b/migrations/Version20250213093448.php @@ -0,0 +1,29 @@ +addSql('UPDATE nodes_sources SET published_at = "2025-02-13 09:34:48" WHERE published_at IS NULL'); + } + + public function down(Schema $schema): void + { + // Do nothing + } +} diff --git a/src/Entity/NodesSources.php b/src/Entity/NodesSources.php index d076f860..63b587bc 100644 --- a/src/Entity/NodesSources.php +++ b/src/Entity/NodesSources.php @@ -570,6 +570,22 @@ public function isReachable(): bool throw new \RuntimeException('This method should only be called from children classes'); } + /** + * Set base data from another node-source. + * + * @return $this + */ + public function withNodesSources(NodesSources $nodesSources): self + { + $this->setTitle($nodesSources->getTitle()); + $this->setPublishedAt($nodesSources->getPublishedAt()); + $this->setMetaTitle($nodesSources->getMetaTitle()); + $this->setMetaDescription($nodesSources->getMetaDescription()); + $this->setNoIndex($nodesSources->isNoIndex()); + + return $this; + } + /** * Returns current listing sort options OR parent node's if parent node is hiding children. */ diff --git a/src/Node/NodeTranstyper.php b/src/Node/NodeTranstyper.php index 52dd72e9..e2a7ea5a 100644 --- a/src/Node/NodeTranstyper.php +++ b/src/Node/NodeTranstyper.php @@ -164,8 +164,8 @@ protected function doTranstypeSingleSource( ): NodesSources { /** @var NodesSources $source */ $source = new $sourceClass($node, $translation); + $source = $source->withNodesSources($existingSource); $this->getManager()->persist($source); - $source->setTitle($existingSource->getTitle()); foreach ($fieldAssociations as $fields) { /** @var NodeTypeField $oldField */