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
}
}
4 Comments
Hello Ryan! Thank you for a beautiful tutorials. I've watched v2 tutorial about custom resources. Recently I moved to ApiPlatform v3.
There is a case that works differently in v3 for me (v 3.1.18)
I have an ApiResource with a property as array of some class objects. It's typehinted with phpdoc as you do in this video:
In jsonld format response I see that property's type ("@type": "SomeRow",)
But on graphical api/docs page it's shown just as array of strings.
In v2 it was shown here with the type as I remember.
Do you have embedded objects type shown on api/docs page? You haven't shown it in your video
Thank you!
Hey @Alexey-N!
❤️
Hmm, good question! I just checked the code - for RIGHT at this chapter - when the
DailyQuestclass still looks like this:And I can confirm that the docs DO look correct to me. Down on the schema at the bottom, for
Quest.jsonld(Questis the short name forDailyQuest), undertreasures, it shows that it is an array ofQuestionTreasure.jsonld, And further up when I try the Get one operation forDailyQuest, theExample Valueconfig DOES show the correct fields.So, unless I'm not understanding your situation, it seems like you and are are doing exactly the same thing, but we're getting different results....
I solved this problem finally :)
That was tricky. I've ended with deploying your code and comparing with my project and it turned out that on my project there was lack of
phpdocumentor/reflection-docblocklibSeems that it was just silently ignoring annotation about embedded object's type
Looks like I missed something when updating symfony and API Platform
Hope it will help someone
Thanks for your answer, it definetely helped!
Hey @Alexey-N!
Ahh, grr to that! Yes, that is kind of a silent dependency - I forget about it too! If you install the api-platform/api-pack - https://github.com/api-platform/api-pack - that includes the
symfony/serializer-pack... and THAT includes this package. If you are missing it, things still work, you're just missing some functionality.So, anyway - excellent debugging on that!
Cheers!
"Houston: no signs of life"
Start the conversation!