SymfonyCasts's profile picture. Injecting Unicorns and Rainbows back into learning PHP // The official way to learn Symfony: http://SymfonyCasts.com

SymfonyCasts 🇺🇦

@SymfonyCasts

Injecting Unicorns and Rainbows back into learning PHP // The official way to learn Symfony: http://SymfonyCasts.com

Performance boost round 2: we'll Use Symfony’s Cache Contracts to cut DB queries - and check out cache tagging! symfonycasts.com/screencast/bun…


Time for a Performance boost! We can cut down database queries with memoization (love that word) and use PHP’s WeakMap to keep memory in check. 💥 symfonycasts.com/screencast/bun…


Our bundle could use a Twig filter. Let's add one and use a Twig runtime to keep things snappy! Oh, and shhh... we'll look at hidden services too. 🕵️‍♀️ symfonycasts.com/screencast/bun…


Our translations work 🥳 but relying on the idea that all entities will have a getId() method? Kinda risky. Let’s make it rock-solid by letting Doctrine handle ID fetching - no hoping and wishing needed! symfonycasts.com/screencast/bun…


Our Setup is done! Now for the real fun, translating our objects 🎉 We’ll fetch + normalize translations with Doctrine and finally see content switch between English & French -- Oh là là! symfonycasts.com/screencast/bun…


We need to mark our Doctrine entities as "translatable". Sure, we could use an interface - but let’s be modern (and a little hip) by using PHP attributes instead! symfonycasts.com/screencast/bun…


We worked a bit with TDD previously, just getting a feel for it. Now it’s time to really lean in and use it in all its glory—rolling out a brand-new feature completely test-first! symfonycasts.com/screencast/bun…


Let's roll up our sleeves, it's time to tackle our object wrapper Twig issue. We’ll replicate the problem in a unit test, then fix it - my favorite way to squash bugs! symfonycasts.com/screencast/bun…


Our bundle's object wrapper doesn’t play nicely with Twig. We'll fix that - but first, let’s write a unit test to be sure it works correctly outside of Twig. We'll all sleep better with code that's properly tested! symfonycasts.com/screencast/bun…


Our bundle is all about translating objects. How are we going to do this? Well, let's look at some options and implement a solution! Booyah! symfonycasts.com/screencast/bun…


Our bundle’s configuration is validated and ready to go, woohoo! Now, let’s put that config to work by injecting it into one of our bundle’s services so it can actually do something useful. symfonycasts.com/screencast/bun…


Bundle configuration nodes can have validation rules. These help make sure the user’s value is what you expect - no ‘cheeseburger’ when you wanted a number. Let’s look at some out of the box rules + create a custom rule! symfonycasts.com/screencast/bun…


Our bundle needs to know about our entity class. Sounds like the perfect job for bundle configuration! We'll define a "node" and add a description + example to help our future users! Go team! symfonycasts.com/screencast/bun…


Our bundle has a Doctrine "mapped superclass" successfully registered. Now we need create the "real" entity in our app, let's go! symfonycasts.com/screencast/bun…


Our bundle now has an object to be used as a Doctrine entity ✅. Our next task is to provide mapping information and let Symfony + Doctrine know about it. symfonycasts.com/screencast/bun…


Bundles can totally provide Doctrine entities... but there are some tricks. Let's discuss the entity we need, create the class, see some bundle-specific considerations and have a great time along the way 😎 symfonycasts.com/screencast/bun…


In bundles, services need to be wired manually - just like Symfony apps in 2011! But don’t worry: it’s simpler now. While we can’t use autowiring inside the bundle, we can make our bundle’s services autowireable. Nice! symfonycasts.com/screencast/bun…


Our bundle is kinda boring still. Let's spice it up with it's first service class! symfonycasts.com/screencast/bun…


Even if you're developing bundles locally, you'll still need to install them with composer. Installation is a little different... but in a good way! We'll even stumble upon a hidden Symfony Flex feature 🌟 symfonycasts.com/screencast/bun…


A bundle requires just one thing: a bundle class - the nerve center of your bundle. Let's create one, right after we fix a little quirk when working with multiple namespaces in the same project. symfonycasts.com/screencast/bun…


Loading...

Something went wrong.


Something went wrong.