Leveraging the Doctrine Data Provider
…down at getCollection(): it creates a query builder and then loops
over something called the "collection extensions". This is the Doctrine extension
system in API Platform, and these extensions are actually what is responsible
for changing the query to add things like pagination and filtering…
Diving into the Normalizer Internals
…The embedded cheeseListings
data has them... but each user does not.
What's going on?
When you work with API Platform, the Symfony serializer has many normalizers.
I'll hit Shift+Shift and search for a class called ItemNormalizer. There are
a bunch of these …
Adding the plainPassword Field
…when a user is updating their password. We talk
about that on an older
Symfony 3 Security Tutorial.
We're going to try a different approach - an approach that's more specific to
API Platform.
Before we get there, let's write a test to…
On Authentication Success
…to /api/users/5? Typically in Symfony, we create the route
and then we can generate a URL to that route by using its internal name. But...
now, API Platform is creating the routes for us. Is there a way with API Platform
to say…
Creating Embedded Objects
…create and save these objects, I'd probably just find where that CheeseListing
is being created and call $entityManager->persist() on it. But because API
Platform is handling all of that for us, we can use a different solution.
Open User, find the $cheeseListings property…
@SerializedName & Constructor Args
…anyone using our API.
It's pretty easy to guess how these properties are created: the keys inside the
JSON literally match the names of the properties inside our class. And in the case
of a fake property like textDescription, API Platform strips off the…
The Delightful World of Vue
…can sink your teeth into, even if JavaScript isn't your main gig. In this tutorial, we'll build a real-world "Products" area for our site using an API-Platform-powered API. Will it be a single-page application (SPA)? Nope! Not in this…
SymfonyCon 2019 Amsterdam Conference Videos
…experiences at this sold-out event. The conference featured 3 tracks, 30 speakers and 33 talks ranging from watching the live release of Symfony 5, to API Platform, Messenger, and many more things.
Ready to watch (or re-watch) the presentations? The videos are available…
Symfony Live Lille 2019 (French)
…Symfony (évidemment), mais aussi Mercure, Doctrine, API Platform ou encore React et Redux ainsi que des bonnes pratiques sur les meilleurs bundles et outils pour vos applications Symfony, et d’autres passionnants sujets !
Vous êtes prêt à regarder (ou revoir) les présentations ? Les vidéos sont…
SymfonyCon 2018 Lisbon Conference Videos
…meet and share their experiences around Symfony. And over 25 speakers presented on topics ranging from the new Symfony web server, to Messenger, to API Platform and so much more.
Ready to watch (or re-watch) the presentations? The videos are now available to everyone.
Client Credentials
…new "Chicken Oversight Operations Platform", or
COOP site has just launched! With COOP, you can login to the site and
collect your chicken eggs, unlock the barn, and do all kinds of other things
just by clicking a button.
Noticing that COOP has an API…
Environment Variables
Open config/packages/framework.yaml. We don't need to be authenticated to use this
raw user content part of GitHub's API:
But if we hit this endpoint a lot, we might hit their rate-limiting, which is pretty low
for anonymous users. So…
API Setup & AJAX with fetch()
…re not going to spend a lot of time talking
about the API side of things: we'll save that for a future tutorial. That's when
we'll also talk about other great tools - like ApiPlatform - that you won't see
used here.
Anyways…
Filtering on Relations
…and hit "Execute".
Let's see... That worked! This shows all treasures owned by any user whose username
contains maug. Pretty cool!
Ok squad: get ready for the grand finale - Subresources. These have seriously
changed in API Platform 3. Let's dive into them next.
Embedded Write
…is not writable via this operation.
Let's think about this. We're updating a DragonTreasure. This means that API
Platform is using the treasure:write serialization group. That group is
above the owner property, which is why we can change the owner.
But if…
On Authentication Success
…look something like '/api/users/'.$user->getId(). But I don't want to hard code
that because we could potentially change the URL in the future. I'd rather have API
Platform generate that for me.
And fortunately, API Platform gives us an autowireable service…
Subresources
…wildcards" in your URL. Pass user_id set to a new Link() object. There are
multiple... we want the one from ApiPlatform\Metadata.
This object needs two things. First, point to the class that the {user_id}
is referring to. Do that by passing a…
Decorating the Core State Provider
…class - make sure to
get the one from ORM.
And yup! That is a valid service id. There is also a harder-to-remember service
id, but API Platform provides a service alias so that we can just use this. Lovely!
Ok, go test go…
x
1000+