Skip to content

Leave to-many and non-resource associations out of page data properties - #617

Merged
silverbackdan merged 1 commit into
mainfrom
fix/page-data-collection-associations
Nov 26, 2026
Merged

silverbackdan merged 1 commit into
mainfrom
fix/page-data-collection-associations

Conversation

@silverbackdan

Copy link
Copy Markdown
Collaborator

PageDataMetadataFactory made every association of a page data class (apart from AbstractPageData's own) a page data property, to-many ones included. A to-many one ended up in PageDataProvider's pd.<property> = :component, so every flush writing an entity it holds was a 500 ("Invalid PathExpression … SingleValuedAssociationField expected"), and it was listed as a component slot.

An association to a class that is not an API resource also broke: AP returns an empty metadata collection, so $metadataCollection[0]->getShortName() was a call on null, a 500 for that class's page data metadata and for any flush that builds every page data metadata.

  • Only single-valued associations to an API resource become page data properties.
  • Unit: tests/Metadata/Factory/PageDataMetadataFactoryTest.php.
  • Functional: tests/Functional/Page/PageDataCollectionAssociationTest.php, with a new PageDataWithVariants (OneToMany variants to a new DummyPageDataVariant resource, ManyToOne supplier to a non-resource DummyPageDataSupplier). The page data metadata collection count goes from 9 to 10.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Nov 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.25%. Comparing base (2ef71ee) to head (ef6a68f).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #617   +/-   ##
=========================================
  Coverage     97.25%   97.25%           
- Complexity     5604     5606    +2     
=========================================
  Files           461      461           
  Lines         14364    14366    +2     
=========================================
+ Hits          13969    13971    +2     
  Misses          395      395           
Flag Coverage Δ
phpunit 97.25% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@silverbackdan
silverbackdan merged commit e15c463 into main Nov 26, 2026
14 of 15 checks passed
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.

1 participant