Skip to content

Add new properties parser which returns new metadata for sulu form xmls #7943

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

Conversation

alexander-schranz
Copy link
Member

@alexander-schranz alexander-schranz commented May 5, 2025

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Fixed tickets fixes #
Related issues/PRs #
License MIT
Documentation PR sulu/sulu-docs#

What's in this PR?

Add new properties parser which returns new metadata.

Why?

Example Usage

This is more internal service. External service should get the metadata via the MetadataProviderRegistry service instead of using the underlaying services.

To Do (Meta WIP)

  • Block mapPropertyMetadata similar to old and imagemap integration
  • Add SchemaMetadataProvider tests, see removed FormMetadataMapperTest.php Schema tests
  • Update content type Tests
  • Update other Tests
  • Fix Call to a member function toJsonSchema() on array
  • needs further validation and discussions if this can even be a float (i dont think as it comes from xml as string always now) https://github.com/sulu/sulu/pull/7943/files#r2086293858

To Do 2

  • Add test for FieldMetadata::findOption
  • Add test for FormMetadata::findTag
  • Add test for FormMetadata::hasTag

To Do 3 all test for mapPropertyMetadata

Check existing changs

  • Update test ImageMapContentTypeTest to new Metadata
  • Update test MediaSelectionContentTypeTest to new Metadata
  • Update test SingleMediaSelectionTest::testMapPropertyMetadata to new Metadata
  • Update test PageTreeRouteContentTypeTest::testMapPropertyMetadata to new Metadata
  • Update test NumberTest::testMapPropertyMetadata new Metadata
  • Update test maybe other testMapPropertyMetadata unit tests

@alexander-schranz alexander-schranz added the Technical Debt Impacts code quality, no or just small impact on end developers and users label May 5, 2025
@alexander-schranz alexander-schranz force-pushed the feature/refactor-form-xml-loader-to-new-properties-parser branch 5 times, most recently from 4565102 to 717fd56 Compare May 5, 2025 15:27
@@ -32,7 +32,7 @@ class OptionMetadata
protected $type;

/**
* @var string|int|OptionMetadata[]
* @var string|float|int|OptionMetadata[]
Copy link
Member Author

@alexander-schranz alexander-schranz May 13, 2025

Choose a reason for hiding this comment

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

was adjusted by @draconivis in: alexander-schranz#8 (comment)

we need to recheck if "new metadata" ever writes as a value float if not we need adjust the test that such data comes as string '1.5' and maybe need to parse it to a float value.

@alexander-schranz alexander-schranz force-pushed the feature/refactor-form-xml-loader-to-new-properties-parser branch 4 times, most recently from ded1b16 to e38b834 Compare May 16, 2025 10:44
@alexander-schranz alexander-schranz force-pushed the feature/refactor-form-xml-loader-to-new-properties-parser branch from e38b834 to 6ad09b9 Compare May 16, 2025 11:53
@alexander-schranz alexander-schranz force-pushed the feature/refactor-form-xml-loader-to-new-properties-parser branch from 96fc201 to f60cce3 Compare May 19, 2025 08:59
@alexander-schranz alexander-schranz force-pushed the feature/refactor-form-xml-loader-to-new-properties-parser branch from e9c9471 to d54d9dc Compare May 19, 2025 09:20
@alexander-schranz alexander-schranz force-pushed the feature/refactor-form-xml-loader-to-new-properties-parser branch from 782af4e to 60cb5d1 Compare May 19, 2025 10:49
Copy link
Member Author

Choose a reason for hiding this comment

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

Most of this service is a copy of existing FormMetadataMapper and old structure loader logic, I did just a little bit refactoring on the xml parse and phpstan baselined the other parts.

@alexander-schranz alexander-schranz marked this pull request as ready for review May 19, 2025 10:50
@alexander-schranz alexander-schranz force-pushed the feature/refactor-form-xml-loader-to-new-properties-parser branch from 60cb5d1 to 0d69812 Compare May 19, 2025 10:56
@@ -35,7 +26,7 @@
*/
class FormMetadataMapper
{
public function __construct(private PropertyMetadataMapperRegistry $propertyMetadataMapperRegistry)
public function __construct()
Copy link
Member

Choose a reason for hiding this comment

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

can be removed

@alexander-schranz alexander-schranz changed the title Add new properties parser which returns new metadata Add new properties parser which returns new metadata for sulu form xmls May 20, 2025
@alexander-schranz
Copy link
Member Author

Adopted the FormXmlLoader with blocks test to test also against global blocks as only the deprecated and the service whiche we want to remove included global blocks metadata.

@alexander-schranz alexander-schranz force-pushed the feature/refactor-form-xml-loader-to-new-properties-parser branch from 8bb17ed to 1434a3d Compare May 20, 2025 05:54
@alexander-schranz alexander-schranz merged commit e706e76 into sulu:3.0 May 20, 2025
9 checks passed
@alexander-schranz alexander-schranz deleted the feature/refactor-form-xml-loader-to-new-properties-parser branch May 20, 2025 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Technical Debt Impacts code quality, no or just small impact on end developers and users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants