Skip to content

[Improvement] Add useInheritedProperties() to the service resolver contracts - #166

Merged
mcop1 merged 2 commits into
2026.xfrom
feature/use-inherited-properties-resolver
Nov 4, 2026
Merged

mcop1 merged 2 commits into
2026.xfrom
feature/use-inherited-properties-resolver

Conversation

@mcop1

@mcop1 mcop1 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Changes in this pull request

Related: pimcore/pimcore#19632

pimcore/pimcore#19632 (merged into 2026.x, Pimcore 2026.4) adds Pimcore\Model\Element\Service::useInheritedProperties(). The contract tests require every public static method of the services in the resolver contracts, so ServiceResolverTest, AssetServiceResolverTest, DocumentServiceResolverTest and DataObjectServiceResolverTest fail in every CI leg that installs pimcore/pimcore 2026.x-dev (seen on #165).

  • useInheritedProperties(bool $inheritProperties, callable $fn, array $fnArgs = []): mixed in the element, asset, document and data object service resolver contracts. Like the other contract methods it calls the core service (Service::useInheritedProperties()).
  • composer.json: pimcore/pimcore ^2026.1 → ^2026.4, because that method only exists from Pimcore 2026.4 on. With minimum-stability: dev this resolves to 2026.x-dev (2026.4.x-dev) until 2026.4.0 is released.
  • Added to the @internal resolver interfaces (ServiceResolverInterface, AssetServiceResolverInterface, DocumentServiceResolverInterface, DataObjectServiceResolverInterface), so the resolver services offer it.
  • Not added to the public *ServiceResolverContractInterface interfaces, on purpose: a new method on a non-internal interface breaks other implementations of it. That is tracked for 2027.1 in [Dev tooling] Fix PHPStan 2.3 findings that need a BC break (2027.1) platform-version#761.
  • Upgrade note for 2026.4.0 (requires Pimcore 2026.4, new method).

Additional info

Regression test: the four contract tests against pimcore/pimcore 2026.x-dev: 4 failures before, all OK after. New UseInheritedPropertiesTest: the callable runs with the given setting and the previous one is restored, also when the callable throws (all four contracts).

Verified locally (PHP 8.4) with the highest and with the lowest dependencies: full Unit suite (122 tests) and PHPStan green.

After merging, #165 needs its branch updated to pick this up.

🤖 Generated with Claude Code

…ntracts

Pimcore 2026.4 adds Element\Service::useInheritedProperties() (pimcore/pimcore#19632), and the contract tests require every public static method of the services in the resolver contracts, so they fail against 2026.x-dev. The contracts toggle AbstractElement's flag the same way, which also works with Pimcore 2026.1 to 2026.3. Added to the @internal resolver interfaces, not yet to the public contract interfaces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mcop1 mcop1 added this to the 2026.4.0 milestone Nov 4, 2026
@mcop1 mcop1 self-assigned this Nov 4, 2026
…nd require Pimcore 2026.4

Like the other contract methods, call Service::useInheritedProperties() instead of toggling the flag here. The method exists from Pimcore 2026.4 on, so the bundle now requires pimcore/pimcore ^2026.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

@mcop1
mcop1 marked this pull request as ready for review November 4, 2026 14:33
Copilot AI balanced review requested due to automatic review settings November 4, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new test file is missing the POCL copyright/license header, which must be added manually because the fixer scans only src.

1 open issue
What changed in this PR

Updates the static resolver bundle to expose Pimcore 2026.4’s useInheritedProperties() helper across element, asset, document, and data object services, addressing the reported contract-test failures.

Changes:

  • Adds forwarding methods and internal interface declarations while leaving public contract interfaces unchanged.
  • Raises the minimum Pimcore dependency to ^2026.4 and documents the upgrade.
  • Adds regression tests for callback arguments, return values, and restoration of the inheritance setting after success or exceptions.

Tests were not executed during this review.

File Description
tests/​Unit/​Models/​Element/​UseInheritedPropertiesTest.php Tests callback behavior and setting restoration across all four contracts.
src/​Models/​Element/​ServiceResolverInterface.php Declares the helper on the internal element interface.
src/​Models/​Document/​DocumentServiceResolverInterface.php Declares the helper on the internal document interface.
src/​Models/​DataObject/​DataObjectServiceResolverInterface.php Declares the helper on the internal data object interface.
src/​Models/​Asset/​AssetServiceResolverInterface.php Declares the helper on the internal asset interface.
src/​Contract/​Models/​Element/​ServiceResolverContract.php Forwards the helper to the core element service.
src/​Contract/​Models/​Document/​DocumentServiceResolverContract.php Forwards the helper to the core document service.
src/​Contract/​Models/​DataObject/​DataObjectServiceResolverContract.php Forwards the helper to the core data object service.
src/​Contract/​Models/​Asset/​AssetServiceResolverContract.php Forwards the helper to the core asset service.
doc/​02_Upgrade_Notes/​README.md Documents the dependency requirement and public-interface exclusion.
composer.json Requires Pimcore ^2026.4.

Review effort: Balanced

@mcop1
mcop1 merged commit 42e2f3e into 2026.x Nov 4, 2026
27 of 28 checks passed
@mcop1
mcop1 deleted the feature/use-inherited-properties-resolver branch November 4, 2026 14:42
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants