core: ReflectionException: Class not found
API Platform version(s) affected: 2.5.4 (from commit https://github.com/api-platform/core/commit/baf054234eff3b9276b6783efb825bff7099d5c9)
Description / How to reproduce
Loading the api docs causes several “class not found” ReflectionExceptions.
Possibly related to https://github.com/api-platform/core/issues/3344
Possible Solution
Seems to be related to src/JsonSchema/TypeFactory:102. If the check in changed from and to or, everything works (working example below)
if ($this->isResourceClass($className) || true !== $readableLink) {
return [
'type' => 'string',
'format' => 'iri-reference',
];
}
Unfortunately I don’t know the internals enough to know if this breaks anything.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 27 (13 by maintainers)
Commits related to this issue
- Type referencing changes to prevent swagger exceptions (external bug) https://github.com/api-platform/core/issues/3344 https://github.com/api-platform/core/issues/3344 https://github.com/api-platform/... — committed to components-web-app/api-components-bundle by silverbackdan 4 years ago
- use FQCN for TranslationInterface (see https://github.com/api-platform/core/issues/3349#issuecomment-711889796) — committed to skuhnow/DoctrineBehaviors by deleted user 3 years ago
- use FQCN for TranslationInterface (see https://github.com/api-platform/core/issues/3349#issuecomment-711889796)w — committed to skuhnow/DoctrineBehaviors by deleted user 3 years ago
- use FQCN for TranslationInterface (see https://github.com/api-platform/core/issues/3349#issuecomment-711889796)w — committed to animus-gmbh/DoctrineBehaviors by skuhnow 3 years ago
I proposed a fix: https://github.com/symfony/symfony/pull/40874
However, there is a workaround for the
Knp\DoctrineBehaviorscase only, import directly the trait imported by the main one.In a nutshell:
Hope it helps!
@soyuka Do you have some news about this issue ? Because i tried to used https://github.com/KnpLabs/DoctrineBehaviors/blob/master/docs/translatable.md and i have : Class App\Entity\TranslationInterface does not exist
Symfony : 5.0.9 API Platform : 2.5.6
FYi, I’ve got a funny one, because of that error in a vendor
@return Returns blablablab:https://github.com/KnpLabs/DoctrineBehaviors/blob/9cc036ee32483c306fb32b4efbf33014ddfb654f/src/Model/Translatable/TranslatableMethods.php#L149
I got errors like
Because in a class in namespace
Lib\Core\Entity\Catalog\Referencei’ve ause TranslatableTraitwhich useTranslatableMethodsnevermind I got to reproduce the bug! thanks
So, I tracked the bugs to php documentor I’ll open issues their regarding these issues.
In the mean time you should use the FQDN in the Trait property… I’ll try to find a quicker solution to these problems.