SymfonyCasts

@symfonycasts.com

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

Rewind ⏪ Doctrine Queries #12 One of my *favorite* systems in Doctrine: Criteria. Keep using your lazy relationships - $spaceCat->getPlanetsExplored() - but tell Doctrine to filter them in the database. Combined with fetch: EXTRA_LAZY, this gets CRAZY cool. symfonycasts.com/screencast/d...

Criteria: Filter Relation Collections

Use Doctrine Criteria to filter a relation collection so a Category can expose only “current” FortuneCookie records, hiding those marked discontinued without writing a separate controller query.

symfonycasts.com

TailwindBundle 1.0 is here! :tada: Add Tailwind CSS to your Symfony + AssetMapper app, with no Node required. A huge thank you to everyone who contributed, reported issues, and helped us reach 1.0! Check out the release: github.com/SymfonyCasts...

Release v1.0.0 · SymfonyCasts/tailwind-bundle

What's Changed Remove deprecation layer by @kbond in #130 Remind users to clear the cache after config changes by @kbond in #136 Authenticate the GitHub API call to avoid rate limiting by @Amoifr ...

github.com

Rewind ⏪ Doctrine Queries #9 Did you know you could select fields from Doctrine and hydrate them into a "NEW MyDtoClass()" right inside your query? Let's take this lesser-known Doctrine feature for a ride! symfonycasts.com/screencast/d...

SELECTing into a New DTO Object

Doctrine can hydrate a custom DTO directly from a SELECT query using NEW, so a repository can return a strongly typed object instead of an associative array for query-specific summary data.

symfonycasts.com

Rewind ⏪ Doctrine Queries #7 Usually we query for *full* entity objects in Doctrine. But that's not always what we need! Let's grab a SUM & use getSingleScalarResult() to fetch just *one* piece of data. symfonycasts.com/screencast/d...

SELECT the SUM (or COUNT)

Uses Doctrine aggregate functions to compute a category’s total numberPrinted across all related FortuneCookie rows in the database instead of loading every entity into PHP and summing in memory.

symfonycasts.com

Rewind ⏪ Doctrine Queries #6 One of my favorite lil' features in Doctrine: fetch: EXTRA_LAZY for when you need to COUNT() a relation. It's easy... though not ALWAYS a benefit (see if you can solve the challenge!) symfonycasts.com/screencast/d...

EXTRA_LAZY Relationships

Uses Doctrine relationship fetching to avoid unnecessary full entity loading: EXTRA_LAZY for count-only collections on the homepage and a custom repository query with JOIN to eliminate a mini N+1…

symfonycasts.com

Rewind ⏪ Doctrine Queries #5 JOINing via a relationship in Doctrine will *not*, automatically reduce queries. Let's fix the N+1 problem with 1 line + learn why we can select from multiple entities... without changing what Doctrine *directly* gives us back. symfonycasts.com/screencast/d...

JOINs and addSelect Reduce Queries

Doctrine lazy-loads Category → FortuneCookie relations in Twig, causing an N+1 query problem on the homepage, and the chapter shows how JOIN plus addSelect() preloads related rows to collapse those…

symfonycasts.com

Upgrading to Symfony 8 #6 (Bonus) AI is changing security research, and that means more vulnerabilities are being found and fixed than ever before. Let's explore "composer audit", CVEs, and how to automate dependency security checks.

Composer Audit and Security Updates

Uses composer audit to find dependency vulnerabilities, interpret advisories/CVEs, temporarily ignore known risks in composer.json, apply fixed updates, and automate recurring security checks with GitHub...

symfonycasts.com

Rewind ⏪ Doctrine Queries #2 Writing raw DQL to see how things work behind-the-scenes is pretty fun. But, in the real world, we use Doctrine's QueryBuilder... though its entire job - as we'll see! - is *still* to write that DQL string. symfonycasts.com/screencast/d...

The QueryBuilder

It's really powerful to understand that DQL is *ultimately* what's being used behind the scenes in Doctrine. But most of the time, we're not going to build this DQL string by hand

symfonycasts.com

🔐 Symfony Security Basics #4 Hashing and encryption are very different things. We'll compare them, & see how Symfony automatically chooses the best password hashing algorithm and transparently upgrades your users as better algorithms become available.

Understanding Password Hashing

Ok, we left off trying to login with a valid username and password, but it didn't work... Let's take a moment to understand why. Over in the terminal, dump our user table with: """terminal symfony console...

symfonycasts.com