Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/EventListener/MeListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Webstack\ApiPlatformExtensionsBundle\EventListener;

use ApiPlatform\Api\FormatMatcher;
use ApiPlatform\Util\ClassInfoTrait;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\NoResultException;
Expand All @@ -19,6 +18,7 @@
use Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Webstack\ApiPlatformExtensionsBundle\Util\ClassInfoTrait;
use Webstack\ApiPlatformExtensionsBundle\Util\MimeType\MimeTypeFlattener;

final class MeListener
Expand Down
20 changes: 20 additions & 0 deletions src/Util/ClassInfoTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Webstack\ApiPlatformExtensionsBundle\Util;

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.

trait ClassInfoTrait
{
use MetadataClassInfoTrait;
}
} elseif (trait_exists(BaseClassInfoTrait::class)) {
trait ClassInfoTrait
{
use BaseClassInfoTrait;
}
}