Skip to content

Conversation

tienvx
Copy link
Contributor

@tienvx tienvx commented Apr 27, 2023

The exception is Uncaught ReflectionException: Class "ApiPlatform\Util\ClassInfoTrait" not found while loading "Webstack\ApiPlatformExtensionsBundle\EventListener\MeListener"

The problem is in api platform 3.1, the trait's namespace changed from ApiPlatform\Util\ClassInfoTrait to ApiPlatform\Metadata\Util\ClassInfoTrait.

This PR create a new trait, which require more code, but still provide support for api-platform/core:3.0. Do we just simply require api-platform/core:^3.1 and use ApiPlatform\Metadata\Util\ClassInfoTrait directly?

@mwansinck
Copy link
Contributor

mwansinck commented May 3, 2023

@tienvx Thanks for your PR. Currently we haven't yet used our bundle with Api Platform 3 yet. Your approach seems good to me. @rvmourik do you agree?

Copy link
Collaborator

@rvmourik rvmourik left a comment

Choose a reason for hiding this comment

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

Hi @tienvx

First of all, sorry for the delay and thank you for contributing. The PR looks good, I have added a minor RFC.

Hope you have the time to change this, so we can merge and tag it.

Thanks

use ApiPlatform\Metadata\Util\ClassInfoTrait as MetadataClassInfoTrait;
use ApiPlatform\Util\ClassInfoTrait as BaseClassInfoTrait;

if (trait_exists(MetadataClassInfoTrait::class)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add some comments which tells what trait is used in 2.x and 3.x.

Copy link
Collaborator

@rvmourik rvmourik left a comment

Choose a reason for hiding this comment

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

Hi @tienvx

First of all, sorry for the delay and thank you for contributing. The PR looks good, I have added a minor RFC.

Hope you have the time to change this, so we can merge and tag it.

Thanks

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

Successfully merging this pull request may close these issues.

3 participants