Chapters
28 Chapters
|
2:51:42
|
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.2",
"ext-ctype": "*",
"ext-iconv": "*",
"api-platform/core": "^3.0", // v3.0.8
"doctrine/annotations": "^1.0", // 1.14.2
"doctrine/doctrine-bundle": "^2.8", // 2.8.0
"doctrine/doctrine-migrations-bundle": "^3.2", // 3.2.2
"doctrine/orm": "^2.14", // 2.14.0
"nelmio/cors-bundle": "^2.2", // 2.2.0
"nesbot/carbon": "^2.64", // 2.64.1
"phpdocumentor/reflection-docblock": "^5.3", // 5.3.0
"phpstan/phpdoc-parser": "^1.15", // 1.15.3
"symfony/asset": "6.2.*", // v6.2.0
"symfony/console": "6.2.*", // v6.2.3
"symfony/dotenv": "6.2.*", // v6.2.0
"symfony/expression-language": "6.2.*", // v6.2.2
"symfony/flex": "^2", // v2.2.4
"symfony/framework-bundle": "6.2.*", // v6.2.3
"symfony/property-access": "6.2.*", // v6.2.3
"symfony/property-info": "6.2.*", // v6.2.3
"symfony/runtime": "6.2.*", // v6.2.0
"symfony/security-bundle": "6.2.*", // v6.2.3
"symfony/serializer": "6.2.*", // v6.2.3
"symfony/twig-bundle": "6.2.*", // v6.2.3
"symfony/ux-react": "^2.6", // v2.6.1
"symfony/validator": "6.2.*", // v6.2.3
"symfony/webpack-encore-bundle": "^1.16", // v1.16.0
"symfony/yaml": "6.2.*" // v6.2.2
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4", // 3.4.2
"symfony/debug-bundle": "6.2.*", // v6.2.1
"symfony/maker-bundle": "^1.48", // v1.48.0
"symfony/monolog-bundle": "^3.0", // v3.8.0
"symfony/stopwatch": "6.2.*", // v6.2.0
"symfony/web-profiler-bundle": "6.2.*", // v6.2.4
"zenstruck/foundry": "^1.26" // v1.26.0
}
}
8 Comments
Under Setting up the Fixtures the sentence
should be:
Hey Alex,
You're right, thanks! Well, we still say it like
User::factory()... but that's a misspell and we clearly useUserFactory::random()on the video, so I fixed it https://github.com/SymfonyCasts/api-platform3/commit/71f42603109698c1ebad04bce8fe08636013e780Cheers!
Hi mate, I have really weird behavior when I tested the relationship with ApiTestCase. From the swagger I'm able to debug my processor state, but when I run the test, I have the following exceptio: ""Failed to denormalize attribute "protocol" value for class "App\Entity\Tramit": Expected argument of type "?App\Entity\Protocol", "Symfony\Component\HttpFoundation\Response" given at property path "protocol"."
The swagger POST request which is running fine
https://ibb.co/WvksJFk
The test which is getting error
https://ibb.co/TrcVVmv
I noticed that when I execute the request from the swagger, the content looks like this:
https://ibb.co/sPSqdtm
But when I executed the test, the same content looks a little different:
https://ibb.co/VB107mm
Is a little weird because I have another tests running well, the only different thing is that on this entities (Tramit and Protocol) I have inverseBy field in Protocol:
https://ibb.co/ZxtXk8w
What I'm trying to achieve is the capability to run a processor in the POST action, this capability is working fine from the swagger but no in the unit test, any help will be ver helpful.
Thanks in advance
Hey @Zahit,
First, have you tried to debug the
$irivariable? does it look like expected?My second thought is about the test data, it maybe not the same as your local copy, I mean probably some relations are not set, that's why it's failing to denormalize objects
Cheers!
Hi!
Something really strange happened to me.
The migration was failing, so I looked at the error and went to the migration files to find the statements causing them.
To my surprise, in the first document, there were references to a table from a previous tutorial interspersed with these.
Any idea how this could have happened?
Maybe something in the Symfony binary cache?
Thanks!
`
`
Yo @Oleguer-C!
Hmm. I don't see those extra
vinyl_mixlines in the migration files we have in the download code for the project, but I CAN think of a general workflow that could add these... it just depends on what actually happened :). A flow might be:A) You previously work on the Doctrine tutorial (with
vinyl_mix)B) You boot up this project, but point it to the same database.
C) Run
make:migrationDoctrine will see the
vinyl_mixstuff and think "that shouldn't be there" and try to drop it. Does this sound feasible? If I'm off the mark, it's still probably some silly detail - unless we have something wrong in our code and I'm not seeing it (definitely possible).Cheers!
Thanks for the reply.
That's what i thought, but in principle shouldn't the dbs of each project be isolated?
Maybe i hadn't downloaded the last container and since the port was exposed i connected to the old container the first time. Who knows.
Thanks
If you're using the Docker integration, then yes, the dbs should, in theory, be in their own container. However, the names of the containers, by default, come from your directory name (not the full directory name - just the last, top-level directory name). So if you put both projects into a directory called
training, for example, then they would share container names and thus share containers :). I have a lot of projects locally, so I hit this sometimes!"Houston: no signs of life"
Start the conversation!