Chapters
36 Chapters
|
3:44:20
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!
Subscribe to download the code!
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=8.1",
"ext-ctype": "*",
"ext-iconv": "*",
"api-platform/core": "3.1.x-dev", // 3.1.x-dev
"doctrine/annotations": "^2.0", // 2.0.1
"doctrine/doctrine-bundle": "^2.8", // 2.10.2
"doctrine/doctrine-migrations-bundle": "^3.2", // 3.2.4
"doctrine/orm": "^2.14", // 2.16.1
"nelmio/cors-bundle": "^2.2", // 2.3.1
"nesbot/carbon": "^2.64", // 2.69.0
"phpdocumentor/reflection-docblock": "^5.3", // 5.3.0
"phpstan/phpdoc-parser": "^1.15", // 1.23.1
"symfony/asset": "6.3.*", // v6.3.0
"symfony/console": "6.3.*", // v6.3.2
"symfony/dotenv": "6.3.*", // v6.3.0
"symfony/expression-language": "6.3.*", // v6.3.0
"symfony/flex": "^2", // v2.3.3
"symfony/framework-bundle": "6.3.*", // v6.3.2
"symfony/property-access": "6.3.*", // v6.3.2
"symfony/property-info": "6.3.*", // v6.3.0
"symfony/runtime": "6.3.*", // v6.3.2
"symfony/security-bundle": "6.3.*", // v6.3.3
"symfony/serializer": "6.3.*", // v6.3.3
"symfony/stimulus-bundle": "^2.9", // v2.10.0
"symfony/string": "6.3.*", // v6.3.2
"symfony/twig-bundle": "6.3.*", // v6.3.0
"symfony/ux-react": "^2.6", // v2.10.0
"symfony/ux-vue": "^2.7", // v2.10.0
"symfony/validator": "6.3.*", // v6.3.2
"symfony/webpack-encore-bundle": "^2.0", // v2.0.1
"symfony/yaml": "6.3.*", // v6.3.3
"symfonycasts/micro-mapper": "^0.1.0" // v0.1.1
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4", // 3.4.4
"mtdowling/jmespath.php": "^2.6", // 2.6.1
"phpunit/phpunit": "^9.5", // 9.6.11
"symfony/browser-kit": "6.3.*", // v6.3.2
"symfony/css-selector": "6.3.*", // v6.3.2
"symfony/debug-bundle": "6.3.*", // v6.3.2
"symfony/maker-bundle": "^1.48", // v1.50.0
"symfony/monolog-bundle": "^3.0", // v3.8.0
"symfony/phpunit-bridge": "^6.2", // v6.3.2
"symfony/stopwatch": "6.3.*", // v6.3.0
"symfony/web-profiler-bundle": "6.3.*", // v6.3.2
"zenstruck/browser": "^1.2", // v1.4.0
"zenstruck/foundry": "^1.26" // v1.35.0
}
}
8 Comments
Hey there,
Everything works great, but any idea why I have this weird schema?
When I run the finish project I see you have something like:
Would be nice to see a IRI example, as it's confusing now.
Guess it's a minor from stateOptions, #[ApiResource() on a Entity itself it works normal.
No idea if it's a deep bug or we are missing something, just wondering if you have a suggestion to get IRI in the schema?
Hey @Rudi-T!
Hmm, you literally have
path/실례.htmlin your schema? That appears to be... a Korean character? And the.htmlis also weird. I have no idea what would be causing this. The mechanism in API Platform is pretty simple for figuring out if an IRI will be generated:A) API Platform looks at the class that it is generated the schema for - e.g.
UserApiB) It looks at the
dragonTreasuresproperty and tries to figure out its type. It does this by looking at PHPDoc, the property type, etc. IF it determines thatdragonTreasuresis a class that has#[ApiResource]above it (or it's an array of this class), then it will generate a schema with IRI strings.So this looks SUPER bizarre to me...
Could it be possible there might be a bug in the latest version of API Platform ?
Since my last
composer updateon an already existing project (API Platform v3.2.3 and Symfony 6.3.7), I have the same thing happen too. IRIs are weirdly shown in Swagger doc, also withpath/실례.htmlinstead of the IRI.Looking at the two other messages in this conversation posted just a few days ago, it raises a legitimate concern.
Thank you very much.
Clément
Hello!!
I'm having the exact same issue!
It appears in every embedded relation
And sometimes it shows "../словник" instead of the embedded uri.
Wow, this is crazy! So, it's NEVER and correct IRI string? And you see the
path/실례.htmlsometimes? And other times../словник?So, looking at API Platform, the string
실례DOES show up in 1 place (thoughсловникdoes not show up anywhere): in aswagger-ui-bundle.jsfile shipped by API Platform.See https://github.com/api-platform/core/issues/5900#issuecomment-1773752880 - that looks like the same thing. So yes, I think this may be a bug or some sort of unexpected change.
I checked the GitHub issue and it seems to be the same thing indeed.
I changed the
swagger-ui-bundle.jsfile to an older version (April 23), and my previous issue is somewhat fixed but still not ideal (no actual IRI, just "string") :But it still gives a hint the issue may be from the
swagger-ui-bundle.jsfile.Another strange thing is that on version 3.2.2, my redocs are no showing the respective IRI, its showing "entity/1".
The "embedded" resource should show "/embedded/{id}", or something like this, but it is showing "/entity/1".
I've got the same strange string on the redocs for every embedded relation. In the Swagger UI, I have "path/실례.html" instead. So, in both cases I dont have the correct IRI.
Yes, I never get the correct IRI.
When using api-platform version 3.1, I got: "../словник" instead of the IRI,
when using api-platform version 3.2.2, I got: "path/실례.html".
I've tried other versions and had same bug in every embedded relation.
"Houston: no signs of life"
Start the conversation!