Skip to content

Commit

Permalink
BUGFIX: Skip node data processing for invalid properties
Browse files Browse the repository at this point in the history
It can happen that node properties are not available in a new version of the package. But when the properties are still part of the neos_contentrepository_domain_model_nodedata table, the migration tries to process the data for a node and throws an exception as the node property is not available in the node type schema anymore.

To prevent that exceptions in the legacy data migration, we skip the procession for such properties and output a warning for the user.

Fixes: #4804
  • Loading branch information
markusguenther committed Dec 15, 2023
1 parent e232a85 commit 06f0539
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ public function run(): ProcessorResult
continue;
}
foreach ($properties as $propertyName => $propertyValue) {
$propertyType = $nodeType->getPropertyType($propertyName);
try {
$propertyType = $nodeType->getPropertyType($propertyName);
} catch (\InvalidArgumentException $exception) {
$this->dispatch(Severity::WARNING, 'Skipped node data processing for the property "%s". The property name is not part of the NodeType schema for the NodeType "%s". (Node: %s)', $propertyName, $nodeType->name->value, $nodeDataRow['identifier']);
continue;
}
foreach ($this->extractAssetIdentifiers($propertyType, $propertyValue) as $assetId) {
if (array_key_exists($assetId, $this->processedAssetIds)) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,12 @@ public function extractPropertyValuesAndReferences(array $nodeDataRow, NodeType
}

foreach ($decodedProperties as $propertyName => $propertyValue) {
$type = $nodeType->getPropertyType($propertyName);
try {
$type = $nodeType->getPropertyType($propertyName);
} catch (\InvalidArgumentException $exception) {
$this->dispatch(Severity::WARNING, 'Skipped node data processing for the property "%s". The property name is not part of the NodeType schema for the NodeType "%s". (Node: %s)', $propertyName, $nodeType->name->value, $nodeDataRow['identifier']);
continue;
}

if ($type === 'reference' || $type === 'references') {
if (!empty($propertyValue)) {
Expand Down

0 comments on commit 06f0539

Please sign in to comment.