diff --git a/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php b/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php index 1eaae89553c..ab23b523892 100644 --- a/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php +++ b/Neos.ContentRepository.Core/Classes/NodeType/NodeType.php @@ -400,13 +400,31 @@ public function getProperties(): array } /** - * Returns the configured type of the specified property + * Check if the property is configured in the schema. + */ + public function hasProperty(string $propertyName): bool + { + $this->initialize(); + + return isset($this->fullConfiguration['properties'][$propertyName]); + } + + /** + * Returns the configured type of the specified property, and falls back to 'string'. * - * @param string $propertyName Name of the property + * @throws \InvalidArgumentException if the property is not configured */ public function getPropertyType(string $propertyName): string { $this->initialize(); + + if (!$this->hasProperty($propertyName)) { + throw new \InvalidArgumentException( + sprintf('NodeType schema has no property "%s" configured. Cannot read its type.', $propertyName), + 1695062252040 + ); + } + return $this->fullConfiguration['properties'][$propertyName]['type'] ?? 'string'; } diff --git a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PropertyOperation.php b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PropertyOperation.php index 127a0244727..dc3701cdda4 100644 --- a/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PropertyOperation.php +++ b/Neos.ContentRepository.NodeAccess/Classes/FlowQueryOperations/PropertyOperation.php @@ -110,7 +110,11 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): mixed return ObjectAccess::getPropertyPath($element, substr($propertyName, 1)); } - if ($element->nodeType->getPropertyType($propertyName) === 'reference') { + $propertyType = $element->nodeType->hasProperty($propertyName) + ? $element->nodeType->getPropertyType($propertyName) + : null; + + if ($propertyType === 'reference') { $subgraph = $this->contentRepositoryRegistry->subgraphForNode($element); return ( $subgraph->findReferences( @@ -120,7 +124,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments): mixed )?->node; } - if ($element->nodeType->getPropertyType($propertyName) === 'references') { + if ($propertyType === 'references') { $subgraph = $this->contentRepositoryRegistry->subgraphForNode($element); return $subgraph->findReferences( $element->nodeAggregateId,