-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Remove PropertyCollectionInterface
#4464
Comments
Moved https://github.com//issues/4317#issuecomment-1725654764
Just to be noted, i like to stub my nodes (without providing a correct node type) and currently the interface allows me to do this simple thing: $properties = ['foo' => "bar"];
$propertyCollection = new class ($properties) extends \ArrayObject implements PropertyCollectionInterface {
public function serialized(): SerializedPropertyValues
{
throw new \BadMethodCallException(sprintf('Method %s, not supposed to be called.', __METHOD__));
}
}; after: $textNodeProperties = new PropertyCollection(
SerializedPropertyValues::fromArray([
'foo' => new SerializedPropertyValue('bar', 'string')
]),
new PropertyConverter(
new Serializer([
new DateTimeNormalizer(),
new ScalarNormalizer(),
new BackedEnumNormalizer(),
new ArrayNormalizer(),
new UriNormalizer(),
new ValueObjectArrayDenormalizer(),
new ValueObjectBoolDenormalizer(),
new ValueObjectFloatDenormalizer(),
new ValueObjectIntDenormalizer(),
new ValueObjectStringDenormalizer(),
new CollectionTypeDenormalizer()
])
)
); related: #4317
|
Moved #4483 (comment) |
Related #4483 |
Removes the `PropertyCollectionInterface` in order to achieve a more reliable behavior and not to give the impression of extension points that are actually not extensible. **Note:** This change disables some functional `NodeHelperTest` because there is currently no easy way to mock the `Node` read model. We'll address this with #4317 Resolves: #4464
Moved https://github.com//issues/4317#issuecomment-1725654764
For a mock helper i like to have an option to tell the node that these are its properties in a simple array format. i experimented with using the serializer to archive this: public function createNode(
?NodeAggregateId $nodeAggregateId = null,
SerializedPropertyValues|array|null $propertyValues = null,
): Node {
if (is_array($propertyValues)) {
$propertyValues = $this->propertyConverter->serializePropertyValues(
PropertyValuesToWrite::fromArray($propertyValues), // hacky as we are using this NodeModification command dto model
$nodeType // i also want to pass the nodeType here hacky, as it needs to have the correct property type defnitions
);
}
# ...
return new Node($propertyValues); |
As discussed in todays weekly we decided to replace the
PropertyCollectionInterface
by a finalPropertyCollection
.The reason is that the collection should have a defined behavior (e.g. return all properties as stored in the database, don't throw on non-existing props, ...)
See related discussion in #4304 (comment)
The text was updated successfully, but these errors were encountered: