Skip to content

Commit 60662cf

Browse files
CephraChristian Frantzen
and
Christian Frantzen
authored
Fix PhpCR migration exception for unpublished languages (#698)
Co-authored-by: Christian Frantzen <[email protected]>
1 parent 4def6b6 commit 60662cf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: Resources/phpcr-migrations/Version202407111600.php

+6
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ private function upgrade(SessionInterface $session): void
8888
/** @var Row<mixed> $row */
8989
foreach ($rows as $row) {
9090
$node = $row->getNode();
91+
if (!$node->hasProperty($templateKey)) {
92+
continue;
93+
}
9194
$structureType = $node->getPropertyValue($templateKey);
9295
$routePathPropertyName = $this->getRoutePathPropertyName($structureType, $locale);
9396

@@ -113,6 +116,9 @@ private function downgrade(SessionInterface $session)
113116
foreach ($rows as $row) {
114117
$node = $row->getNode();
115118
$propertyName = $this->propertyEncoder->localizedContentName(RoutableSubscriber::ROUTE_FIELD_NAME, $locale);
119+
if (!$node->hasProperty($propertyName)) {
120+
continue;
121+
}
116122
$node->setProperty($propertyName, null);
117123
}
118124
}

0 commit comments

Comments
 (0)