Skip to content

Feature/extensible metadata properties#12

Open
c4ll-m3-j4ck wants to merge 9 commits intoneos:feature/extensible-metadata-propertiesfrom
c4ll-m3-j4ck:feature/extensible-metadata-properties
Open

Feature/extensible metadata properties#12
c4ll-m3-j4ck wants to merge 9 commits intoneos:feature/extensible-metadata-propertiesfrom
c4ll-m3-j4ck:feature/extensible-metadata-properties

Conversation

@c4ll-m3-j4ck
Copy link
Copy Markdown

This PR adds necessary changes to work with the updated implementation in Flowpack.Media.Ui

Comment thread Classes/Command/AssetMetaDataMigrationCommandController.php Outdated
return $spacePoint;
}
}
return null;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just wondering: shouldn't this fail instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed: We probably don't even need to expose this

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use this in the changes made to Flowpack.Media.Ui currently, but it could be replaced by using the new map() implementation and filtering on the consumer-side.

So I concur, I'll remove it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's definitely not an important point. But if we remove it, we don't have to settle on the failure behavior :)

Comment thread Classes/Helper/AssetMetaDataHelper.php Outdated
Comment thread Classes/Helper/AssetMetaDataHelper.php Outdated
Comment thread Configuration/Settings.yaml Outdated
@c4ll-m3-j4ck c4ll-m3-j4ck force-pushed the feature/extensible-metadata-properties branch from b89f276 to 86a1684 Compare April 17, 2026 20:08
Copy link
Copy Markdown
Member

@bwaidelich bwaidelich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c4ll-m3-j4ck Thanks a lot for your work, it's a great direction IMO.
I just added some (mostly nitpicky) comments.

IMO this can be merged onto the feature branch so that we can work on a common code base

/**
* A point in the dimension space with coordinates DimensionName => DimensionValue.
* E.g.: ["language" => "es", "country" => "ar"]
* E.g.: ["language" => ["es"], "country" => ["ar"]]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code was more or less copied from the original AbstractDimensionSpacePoint.php.
AFAIK, the DSP is a concrete point in the dimension – now this is rather describing the whole dimension space

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this change to the structure to achieve the same hashing result as in the CR in v8. The dsp hashes are generated by hashing over exactly this structure (dimensions => [value]). I honestly don't know why it is done that way but I wanted to align the hashes.

But yeah, technically this could describe the entire dimension space. I don't have a strong opinion on this one, it's probably clearer to the intent if we do it correctly. The only thing this would mean is that we don't have a direct relation between the dsp-hashes of the old cr and ours.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I was looking at the Neos 9 code where the hash for empty is d751713988987e9331980363e24189ce (which is equivalent to md5(json_encode([]))) and the hash for en_UK is 046d33049fe2ab3d1c3c54ca5340186f which is the equivalent to md5(json_encode(['language' => 'en_US'])).
But you are correct, that this is stored differently in Neos 8 – I wasn't aware of that.
I would suggest to keep the DTOs clean though and somehow "translate" it in the concrete v8 adapter if possible

return $spacePoint;
}
}
return null;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed: We probably don't even need to expose this

yield from $this->spacePoints;
}

public function getHashIterator(): Traversable
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: It's called getIterator above only because that's the interface, but it is not meant to be invoked manually.
If we expose all hashes I would suggest to replace

   'dimensionHashes' => iterator_to_array($dimensionSpacePoints->getHashIterator()),

by

  'dimensionHashes' => $dimensionSpacePoints->getHashes(),

or: don't expose them and go for

final readonly class MetaDataDimensionSpacePoints implements IteratorAggregate {
  // ...

  /**
   * @template T
   * @param Closure(MetaDataDimensionSpacePoint): T
   * @return T[]
   */
  public function map(Closure $callback): array {
    return array_map($callback, $this->spacePoints);
  }

and

  'dimensionHashes' => $dimensionSpacePoints->map($spacePoint->hash)

Comment thread Configuration/Settings.yaml Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants