Skip to content

MediaSmartContentProvider does not use AccessControlQueryEnhancerInterface but concrete Implementation #9106

Description

@MarkusHolstein

Problem description

MediaSmartContentProvider currently depends on the concrete AccessControlQueryEnhancer implementation instead of the corresponding AccessControlQueryEnhancerInterface.

The constructor currently uses:

public function __construct(
    private EntityManagerInterface $entityManager,
    private SmartContentQueryEnhancer $smartContentQueryEnhancer,
    private TranslatorInterface $translator,
    private WebspaceManagerInterface $webspaceManager,
    private AccessControlQueryEnhancer $accessControlQueryEnhancer,
    private ?Security $security,
    private bool $hasAudienceTargeting = false,
    private ?array $permissions = null,
)

The dependency should use AccessControlQueryEnhancerInterface instead:

private AccessControlQueryEnhancerInterface $accessControlQueryEnhancer,

This would allow the component to depend on the abstraction rather than a concrete implementation and makes it possible to provide a custom implementation through the interface.

Interface signature is out of sync

Additionally, the enhance() method of AccessControlQueryEnhancer has been extended with a new parameter:

string $entityIdField = 'id'

However, this parameter has not been added to AccessControlQueryEnhancerInterface.

The interface and its implementation should therefore expose the same method signature.

Proposed solution

Inject the Interface and and add the parameter to the interface ;-)

As always: I could provide the fix. The question is, should this be two PRs?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew functionality not yet included in Sulu

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions