Skip to content

Commit

Permalink
Fix PhpCR migration exception for unpublished languages (#698)
Browse files Browse the repository at this point in the history
Co-authored-by: Christian Frantzen <[email protected]>
  • Loading branch information
Cephra and Christian Frantzen authored Aug 27, 2024
1 parent 4def6b6 commit 60662cf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Resources/phpcr-migrations/Version202407111600.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ private function upgrade(SessionInterface $session): void
/** @var Row<mixed> $row */
foreach ($rows as $row) {
$node = $row->getNode();
if (!$node->hasProperty($templateKey)) {
continue;
}
$structureType = $node->getPropertyValue($templateKey);
$routePathPropertyName = $this->getRoutePathPropertyName($structureType, $locale);

Expand All @@ -113,6 +116,9 @@ private function downgrade(SessionInterface $session)
foreach ($rows as $row) {
$node = $row->getNode();
$propertyName = $this->propertyEncoder->localizedContentName(RoutableSubscriber::ROUTE_FIELD_NAME, $locale);
if (!$node->hasProperty($propertyName)) {
continue;
}
$node->setProperty($propertyName, null);
}
}
Expand Down

0 comments on commit 60662cf

Please sign in to comment.