Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Explicit value object support for node properties #3716

Open
wants to merge 1 commit into
base: 8.3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions Classes/Domain/Service/NodePropertyConversionService.php
Expand Up @@ -18,6 +18,7 @@
use Neos\Flow\Mvc\Controller\MvcPropertyMappingConfiguration;
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
use Neos\Flow\Property\PropertyMapper;
use Neos\Flow\Property\TypeConverter\DenormalizingObjectConverter;
use Neos\Flow\Property\TypeConverter\PersistentObjectConverter;
use Neos\Utility\Exception\InvalidTypeException;
use Neos\Utility\TypeHandling;
Expand Down Expand Up @@ -52,6 +53,18 @@ public function convert(NodeType $nodeType, $propertyName, $rawValue, Context $c
{
$propertyType = $nodeType->getPropertyType($propertyName);

/**
* Explicit value object support, as they can be stored directly the node properties flow_json_array
* {@see \Neos\Flow\Persistence\Doctrine\DataTypes\JsonArrayType::serializeValueObject}
*/
$valueIsDeserializeable = DenormalizingObjectConverter::canConvertFromSourceType(
gettype($rawValue),
$propertyType
);
if ($valueIsDeserializeable) {
return DenormalizingObjectConverter::convertFromSource($rawValue, $propertyType);
}

switch ($propertyType) {
case 'string':
return $rawValue;
Expand Down