Skip to content

[RFC] Authorize interface as resource #1574

Description

@Nek-

Problem

In my application I use the KnpDictionaryBundle. This bundle provide an interface to implement dictionaries but no resource class (but provide a dictionary registry), which is incompatible with api platform ATM.

I think api platform should authorize interface as a resource because I'm pretty sure it's not the only software to act like this.

Solution

Modify the ExtractorResourceMetadataFactory to support interfaces:

// before
if (!class_exists($resourceClass) || !$resource = $this->extractor->getResources()[$resourceClass] ?? false)

// After
if (!(class_exists($resourceClass) || interface_exists($resourceClass)) || !$resource = $this->extractor->getResources()[$resourceClass] ?? false)

What do you think?

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions