-
-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClassificationBundle\Model\CategoryInterface does not exist while using API Platform #2399
Comments
I woul say that we can try removing the annotation for the Model classes but not for all the project. Can you try the PR? It will probably fail on phpstan and psalm, let's see if it is fixable. |
Hi @kerattila, We does not support any object as category, but only
We could try
But if it does not work, I would say the issue in on Swagger which shouldnt hard fail on such situation with optional feature/dependencies. Phpdoc is not "real" code, it should be allowed to write what we want on it ; that's why attributes was invented for "interpreted phpdoc". |
Does updating the phpdoc to
solve your issue @kerattila ? |
Any chance the issue to be fixed with the next release? |
Open source is easy. If you want something to be fixed, fix it ;) I didn't even got a response from my previous question, I won't spend more time on this. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hey @VincentLanglet , idk where did the OP go, or if he gave up on it (reasonable). But to answer you:
That said, I'm obviously encountering the error as well and I find it funny that 1 year later we still there. |
Feel free to work on a PR or to sponsor maintainers which are working on these repository on they free time.
I still believe that API Platform has issue since it crash on PHP annotation, which is are only comment, and should be trusted like typing or PHP Atributes. That's the whole reason for PHP Attribute introductions. Comments are comments, not real code. |
No hard feelings towards maintainers that will always have my respect, I just found a little misleading your statement "Open source is easy. If you want something to be fixed, fix it". Not everyone is actually able to fix any problem. That said, I forgot to add the
annotation above |
Can you try #2463 to see if this branch solve the issue then ? |
@VincentLanglet just tried and it works like a charm. Thanks!! |
You're welcome.
I disagree. All was explained in #2399 (comment) ; just nobody care to take the time to open the PR (like often in open source). Everybody can become a contributor, it's not reserved for some "better developers". |
Environment
Sonata packages
show
Symfony packages
show
PHP version
Subject
A combination of Sonata Admin, Sonata Media Media Bundle and API Platform, the
/api
endpoint fails withClass "Sonata\ClassificationBundle\Model\CategoryInterface" does not exist
.Currently there are multiple references to a non-existing class, from an unused package.
List of references:
SonataMediaBundle/src/Model/MediaInterface.php
Line 128 in 836b101
SonataMediaBundle/src/Listener/ORM/MediaEventSubscriber.php
Line 31 in 836b101
SonataMediaBundle/src/Model/Media.php
Line 81 in 836b101
From my point of view, if return type is
?object
then also the annotations/comments should be object (eg./* @var object|null */
)Minimal repository with the bug
Don't have yet but could provide if it's necessary.
Steps to reproduce
Install Sonata Admin, Sonata Media Bundle and API Platform, navigate to the Swagger interface and observe the error.
Expected results
Have a working API Platform Swagger interface.
Actual results
I see an exception on the Swagger interface with the following message:
Class "Sonata\ClassificationBundle\Model\CategoryInterface" does not exist
show
More informations
As a workaround, this can be handled by overriding the category property like this:
I can provide a PR if the the proposed solution is doable.
The text was updated successfully, but these errors were encountered: