Advertisement · 728 × 90

Posts by SymfonyCasts

Preview
Custom Transport Serializer If an external system sends messages to a queue that we're going to read, those messages will probably be sent as JSON or XML. We added a message formatted as JSON

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...

2 days ago 0 0 0 0
Preview
Custom Transport Serializer If an external system sends messages to a queue that we're going to read, those messages will probably be sent as JSON or XML. We added a message formatted as JSON

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...

3 days ago 1 0 0 0
- YouTube
- YouTube Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.

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

4 days ago 1 0 0 0
Preview
Routing with Doctrine Inheritance Let's create a dedicated show page for our starships and check out how routing works with Doctrine inheritance entities. We first need a new controller, so hope over to the terminal and run: """terminal...

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!

5 days ago 2 1 0 0
Preview
Transport for Consuming External Messages We've just created a new message class & handler... then instantiated it and dispatched it directly into the message bus. Yep, we just did something totally... boring! But... it's actually pretty…

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...

6 days ago 0 0 0 0
Preview
Setup for Messages from an Outside System What if a queue on RabbitMQ was filled with messages that originated from an *external* system... but we wanted to consume and *handle* those from our Symfony App? For example, maybe a user can…

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...

1 week ago 0 0 0 0
Preview
Inheritance with Twig You see each of these starship rows here? They show the generic Starship properties. I want to make these a bit more interesting by showing the custom Starship properties for our sub-ships in these…

Doctrine Inheritance #6 Today, let's see what happens when Twig template inheritance meets Doctrine inheritance! 🤯 symfonycasts.com/screencast/d...

1 week ago 1 1 0 0
Preview
Serializing Messages as JSON Once you start using RabbitMQ, a totally different workflow becomes possible... a workflow that's *especially* common with bigger systems. The idea is that the code that *sends* a message might *not*…

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...

1 week ago 0 0 0 0
Why You Should Never Use orWhere in Doctrine
Why You Should Never Use orWhere in Doctrine Using `orWhere()` in Doctrine might seem harmless, but it can lead to subtle bugs due to how conditions are grouped in SQL. In this video, we’ll look at why `orWhere()` can cause unexpected results and the safer way to handle OR conditions using andWhere(). To learn more about Doctrine Queries check out our full course: https://symfonycasts.com/screencast/doctrine-queries

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

1 week ago 0 0 0 0
Advertisement
Preview
Dynamic AMQP Routing Key (AmqpStamp) Let's repeat the new exchange setup for the "async_priority_high" transport: we want this to deliver to the *same* direct exchange, but then use a different routing key to route messages to a…

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...

1 week ago 1 0 0 0
Preview
Exchange Routing and Binding Keys Let's change this delay back to one second... so we're not waiting all day for our photos to be processed. ...

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...

2 weeks ago 1 0 0 0
Preview
Querying Classes Let's see how we can query specific types of ships. Here, we see a list of all starships

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...

2 weeks ago 1 1 0 0
Preview
Delaying in AMQP: Dead Letter Exchange When we started working with AMQP, I told you to go into "ImagePostController" and remove the "DelayStamp". This stamp is a way to tell the transport system to *wait* at least 500 milliseconds before…

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...

2 weeks ago 1 0 0 0
Preview
Class Table Inheritance Time to let's dive into the final type of Doctrine Inheritance: Class Table Inheritance. This one goes back to using a single table per entity in the hierarchy

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!

2 weeks ago 2 1 0 0
Post image

Come meet folks from @Symfony.com & @SymfonyCasts.com at our #DrupalCon booth tomorrow—and grab some swag!

2 weeks ago 3 2 0 0
Preview
AMQP Internals: Exchanges & Queues We've just changed our messenger configuration to send messages to a cloud-based RabbitMQ instance instead of sending them to Doctrine to be stored in the database. And after we made that change...…

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...

2 weeks ago 1 0 0 0
Preview
AMQP Priority Exchange The idea behind our "async" and "async_priority_high" transports was that we can send some messages to "async_priority_high" and others to "async", with the *goal* that those messages would end up in…

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...

2 weeks ago 1 0 0 0
Advertisement
Preview
AMQP with RabbitMQ Open up your ".env" file and check out the "MESSENGER_TRANSPORT_DSN" setting

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...

3 weeks ago 1 0 0 0
Preview
Single Table Inheritance Alright, so in order to be able to fetch all the starships at once, we need to use Doctrine's second type of inheritance: Single Table Inheritance. With this feature, all entities that are part of the...

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!

3 weeks ago 2 2 0 0
Preview
Sending Handlers to Different Transports: from_transport The last option I want to mention *is* interesting... but can also be confusing. It's called "from_transport"

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...

3 weeks ago 2 0 0 0
Preview
Advanced Handler Config: Handler Subscribers Open up "DeleteImagePostHandler". The *main* thing that a message bus needs to know is the *link* between the "DeleteImagePost" message class and its handler

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...

4 weeks ago 1 0 0 0
Preview
Foundry Fixtures for Inheritance Ok, we left off with an error when we tried to load our fixtures. Open "src/Factory/StarshipFactory"

Doctrine Inheritance #2
🏭 When using Foundry factories with Doctrine inheritance, a few tricks can help keep duplication down. Let's go!

1 month ago 1 0 0 0
Preview
Query Bus The last type of bus that you'll hear about is... the double-decker tourist bus! I mean... the query bus! Full disclosure... while I *am* a fan of waving like an idiot on the top-level of a tourist…

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...

1 month ago 1 0 0 0
Preview
Mapped Superclasses Coming soon...

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!

1 month ago 1 1 0 0
Preview
Query Bus The last type of bus that you'll hear about is... the double-decker tourist bus! I mean... the query bus! Full disclosure... while I *am* a fan of waving like an idiot on the top-level of a tourist…

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...

1 month ago 1 0 0 0
Advertisement
Preview
Doctrine Transaction & Validation Middleware We're now using both a command bus pattern, where we create commands and command handlers, and the event bus pattern: we have our first event and event handler. The difference between a command and…

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...

1 month ago 1 0 0 0
Preview
Doctrine Transaction & Validation Middleware We're now using both a command bus pattern, where we create commands and command handlers, and the event bus pattern: we have our first event and event handler. The difference between a command and…

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...

1 month ago 0 0 0 0
Preview
`translate_object` Twig Filter We have our "ObjectTranslator" service fully working. It can be injected and used in PHP code like we're doing in "ArticleController::show()"

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...

1 month ago 1 0 0 0
Preview
Messenger vs EventDispatcher If you've ever create an event listener or event subscriber in Symfony, you're creating a "listener" for an event that's dispatched through a service called the "event dispatcher". The purpose of the…

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...

1 month ago 1 0 0 0
Preview
Dispatching the Event & No Handlers Back in "DeleteImagePostHandler", we need to dispatch our new "ImagePostDeletedEvent" message. Earlier, we created a *second* message bus service

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...

1 month ago 1 0 0 0