Rewind ⏪ Symfony Messenger #46
When a message is handled async by a Messenger worker, it's dispatched *back* through the message bus! And *stamps* are a key part of the process. Let's take a closer look at this & add a missing BusNameStamp in our custom serializer symfonycasts.com/screencast/m...
Posts by SymfonyCasts
Rewind ⏪ Symfony Messenger #45
One of the most *versatile* parts of a Messenger transport is its *serializer*. Let's create a custom serializer & use it to decode JSON messages from the queue into the exact message objects we need. symfonycasts.com/screencast/m...
SymfonyCasts Snippets: Solving the N+1 Problem with Doctrine
Hitting the N+1 problem in Doctrine ORM? Let’s see why it happens and how to fix it so you can go from many queries down to one ⚡
youtu.be/xhiokeH99PU
Doctrine Inheritance #7
Routing + entity value resolver + Doctrine inheritance = a thing of beauty! Plus, we'll use our dynamic Twig template trick right inside a controller - awesome!
Rewind ⏪ Symfony Messenger #44
To consume "external" messages from a queue in Messenger, let's set up a dedicated transport to read them. For the first time, we'll use "auto_setup: false"... and let someone *else* take care of creating things in RabbitMQ #Symfony symfonycasts.com/screencast/m...
Rewind ⏪ Symfony Messenger #43
Need to use Messenger to consume messages put into a queue by an outside app? Fun! I mean, no problem!
symfonycasts.com/screencast/m...
Doctrine Inheritance #6 Today, let's see what happens when Twig template inheritance meets Doctrine inheritance! 🤯 symfonycasts.com/screencast/d...
Rewind ⏪ Symfony Messenger #42
If you decide to use the *Symfony* serializer for your Messenger transport, your messages will be delivered as pure JSON. If you also *consume* those messages, how does Symfony know which class to deserialize into? Let's find out!?
symfonycasts.com/screencast/m...
orWhere() in Doctrine looks innocent… but can mess up your query logic 😅 Let’s see why and how to handle OR conditions the right way.
youtu.be/S0Jq7qljVPU
Rewind ⏪ Symfony Messenger #41
Messenger *usually* serializes messages using the native PHP serialize() function. But you can *also* leverage Symfony's serializer component to send messages as JSON or XML. Especially handy if an external system will consume them.
symfonycasts.com/screencast/m...
Rewind ⏪ Symfony Messenger #40
In Symfony Messenger, we've set up a direct exchange in RabbitMQ with binding keys & routing keys. We *rule*. Now we can leverage our system - and the AmqpStamp - to dynamically control *exactly* how each message is delivered. symfonycasts.com/screencast/m...
Doctrine Inheritance #5
Need to query specific types in an inheritance hierarchy? You're in luck, DQL has a built-in expression for that! Let's get our query on! symfonycasts.com/screencast/d...
Rewind ⏪ Symfony Messenger #39
Level-up our Messenger-RabbitMQ integration by switching from a fanout exchange to a direct exchange. We'll teach our transport 2 new tricks: how to bind a queue to an exchange w/ a binding key & how to send a message w/ a routing key symfonycasts.com/screencast/m...
Doctrine Inheritance #4
Last but not least: Class Table Inheritance! Split your entity hierarchy across tables, stitched together with JOINs and love ❤️. Let’s see it in action!
Come meet folks from @Symfony.com & @SymfonyCasts.com at our #DrupalCon booth tomorrow—and grab some swag!
Rewind ⏪ Symfony Messenger #37
To setup priority transport/queues w/ RabbitMQ & Symfony Messenger, we'll leverage the "exchange" and "queues" config. Let's learn exactly what these powerful options control & use them to make some messages more important than others! symfonycasts.com/screencast/m...
Rewind ⏪ Symfony Messenger #38
If you want to see & understand the power of RabbitMQ, just look at how "delayed" messages are handled w/ Symfony Messenger. Let's dive into the "delays" transport, temp queues, bindings, message TTLs and dead-letter-exchanges. Woh. symfonycasts.com/screencast/m...
Rewind ⏪ Symfony Messenger #36
Ever wanted to know how RabbitMQ/AMQP works? All that exchange and queue stuff? We've got you covered, with diagrams & a real-life example to track a message through the *entire* lifecycle in Symfony Messenger. Hey, Rabbit is fun! symfonycasts.com/screencast/m...
Doctrine Inheritance #3
Ready for the next inheritance type? Single Table Inheritance is a slick way to store an entire entity hierarchy in one table. Let’s check it out!
Rewind ⏪ Symfony Messenger #35
Ready to up your queueing game? We're switching from the Doctrine Messenger transport to AMQP - specifically RabbitMQ. Yep, we're going to learn *all* about how RabbitMQ works and *love* the journey #Symfony symfonycasts.com/screencast/m...
Rewind ⏪ Symfony Messenger #34
If a message in Messenger has multiple handlers, can you prioritize one handler over another? Yep! With the combination of priority transports and the interesting "from_transport" handler option. #Symfony symfonycasts.com/screencast/m...
Doctrine Inheritance #2
🏭 When using Foundry factories with Doctrine inheritance, a few tricks can help keep duplication down. Let's go!
Rewind ⏪ Symfony Messenger #33
One of my favorite features of Messenger is how easy the setup is: Symfony automatically links a message to a handler by reading your type-hint. What if you need more control? Say hello to a message handler *subscriber* symfonycasts.com/screencast/m...
New course alert! 🚨 Doctrine Inheritance #1
Want to share fields and behavior across multiple entities? Let’s start with the simplest form: the Mapped Superclass!
Rewind ⏪ Symfony Messenger #32
We've talked about command & event buses already. Now it's time to talk about the final type: a school bus! I mean, a query bus!? symfonycasts.com/screencast/m...
Rewind ⏪ Symfony Messenger #31
Ready to see a cool Symfony services config trick? We use auto-registration, sub-directories and tags to bind our command handlers *only* to the command bus & our event handlers *only* to the event bus. An optional, but geeky-fun step! symfonycasts.com/screencast/m...
Rewind ⏪ Symfony Messenger #30
Messenger has a few other built-in, but optional middleware that we haven't talked about. Let's look into the validation & doctrine_transaction middleware, talk about what each does and why you might (or might not) use them #Symfony symfonycasts.com/screencast/m...
Twig loads all extensions on each request - even unused ones. To keep things fast, push heavy logic into a Twig runtime. Pro tip: the runtime can be any service, not just something Twig-specific.
👉 symfonycasts.com/screencast/b...
Rewind ⏪ Symfony Messenger #29
If Symfony has an EventDispatcher... and also Messenger is able to dispatch events... what’s the difference between EventDispatcher & Messenger? And when should I use one versus the other? Excellent question! symfonycasts.com/screencast/m...
Rewind ⏪ Symfony Messenger #28
We’ve created an “event” and an “event handler”. Let’s finish this by dispatching that into our Messenger-powered event bus. Also: what happens if an event has *no* handlers? In a perfect world... that should be allowed. #Symfony symfonycasts.com/screencast/m...