1000 search results

Setting the UUID on POST

… Remember: API platform - well really, Symfony's serializer - is really good at reading your types. It notices that the type for $uuid is UuidInterface and uses that to try to find a denormalizer that understands this type. And fortunately, API Platform comes with a denormalizer…

5:15
Custom Filter apply()

…implement the FilterInterface from the core Serializer\ namespace, API Platform will help us a bit: How? By automatically calling our apply() method on every request for an API resource where our filter has been activated: What I mean is, in DailyStats we added @ApiFilter(DailyStatsDateFilter:…

8:15
Input DTO: Denormalizing IRI Strings

…data into that type - like creating a DateTime object from a date string. There are various normalizers that are good at doing this. And... fortunately API Platform comes with an ItemNormalizer whose job is to change IRI strings into objects by querying the database... or..…

5:33
Passing data From the Server to Vue

…way. Add IriConverterInterface $iriConverter to get a service from API Platform. Remember: when you click on the Catalog component in the Vue Dev tools and look at the products data, each item that we get back from our API - whether it's a product, category…

6:46
Dynamic Groups without Caching

…And... that's fine! Symfony handles all of that behind the scenes. In the case of the resource metadata factory, API Platform itself decorates that service multiple times... each "layer" adding a bit more functionality. Normally, when we decorate a service from our application, our…

10:34
Automatic 404 on Unpublished Items

…individual CheeseListing if it's unpublished. The collection query extension does not take care of this: this method is only called when API Platform needs to query for a collection of items - a different query is used for a single item. Let's write a…

5:26
Microservices Gone Wrong

…ve all gone out and built systems. And a team that I had the opportunity to lead a number of years ago, we wound up building a platform. And I'm gonna tell you a little about the background. But we made a bunch of…

39:20
Custom Logic Only for some Operations

…which operation is being used. But if you start also using a PATCH operation or custom operations, then this would not be enough. Like many parts of ApiPlatform, a data persister has a normal interface - DataPersisterInterface: But also an optional, stronger interface that gives you…

5:02
Publishing a Listing

…waiting for our cheese. So... how should we design this in our API? You might think that we need a custom endpoint or "operation" in ApiPlatform language. Something like POST /api/cheeses/{id}/publish. You can do this. And we'll talk about custom operations…

6:02
PropertyFilter: Sparse Fieldsets

…about a protocol that adds features to your web server. It was created by the API Platform team, and if we scroll down a bit, they have a really good example. Pretend that we have the following API. If we make a request to /books…

6:55
Passing Values to Stimulus

…a small percentage of your users to be susceptible to CSRF attacks. If you want to learn more, our API Platform 2 tutorial has a whole chapter on SameSite cookies and CSRF tokens. Next, let's turn to the other authentication use-case: API tokens.

4:32
Serializing Messages as JSON

…property into JSON. We're not going to go too deep into Symfony's serializer component, but if you want to know more, we go much deeper in our API Platform Tutorial. Anyways, this simple JSON structure is something any other system could understand. So..…

6:41
DTO Quirks

…just delete it so that the tests will pass. But good news! Thanks to the API Platform team, this bug has been fixed and should be released in API Platform 2.5.8. But since that hasn't been released yet at the time of…

5:23
Query Extension: Auto-Filter a Collection

…for a specific resource or even for a specific operation of a resource. They're... basically... awesome. Let's get our extension going: in the src/ApiPlatform/ directory, create a new class called CheeseListingIsPublishedExtension. Make this implement QueryCollectionExtensionInterface and then go to the Code ->…

9:37
Knowing your State Machines

…I'm sorry, show him or her later. Quick about me. I do plenty of work on Happyr. We are a job advert platform - it matches people with confidence, blah blah. I do plenty of Symfony things. I run PHP meetups in Stockholm and I…

45:03
Head first into Symfony Cache, Redis & Redis Cluster (Andre Rømcke)

…application. So in our case on the eZ Platform side, we did change this to make sure we could take advantage of looking up several things at the same time. Instead of us having our API where you load one thing at the same time…

37:44
Back to the Basics (Symfony local Web Server)

…then you can get started really easily. The problem is that it comes with many limitations and I'm going to talk about that in minute. Docker, well may be slow depending on the platform, especially on a Mac. I mean it is for me…

31:36
Decoration: Override Core Services & AsDecorator

…wild? The answer to that is... sort of all over! In API Platform, it's common to use decoration to extend core services like the ContextBuilder. And Symfony itself uses decoration pretty commonly to add debugging features while we're in the dev environment. For…

9:56
Sluggable: Doctrine Extensions

…You do this by creating an event subscriber or entity listener. We do have an example of an entity listener in our API Platform tutorial if you're interested. Next, let's add two more handy fields to our entity: createdAt and updatedAt. The trick…

5:57
Serializer Error Renderer: JSON/XML Errors

…If you wanted to change this data, you could do that by adding your own custom normalizer. We actually talk about this in our API Platform Security Tutorial. You could decorate the ProblemNormalizer... and maybe just add or tweak some data or you could create…

5:40