1000 search results

Symfony Console Commands

…we only want to run if this is a development machine, because it resets the database. We'll talk about controlling that later. For this command, use hautelook_alice:doctrine:fixtures:load --no-interaction: Ok! The 3 commands are ready! Head back to the terminal…

5:38
JoinColumn & Relations in Fixtures

…Alice will now look at the 10 Genus objects matching this pattern and select a random one each time. Reload the fixtures: It's alive! Check out the results again with doctrine:query:sql: Every single one has a random genus. Do you love it…

3:15
PHP 8.4 & Recipe Updates

…we have a bunch to update. We'll go through them one-by-one. Hitting enter will use the first one in the list, doctrine/deprecations. "No file changed...". Hmm, run git status so see what's up. Just the symfony.lock file was modified…

11:21
Installing API Platform

…s empty because we don't, ya know, actually have an API just yet, but this is going to come to life very soon. Next: Let's create our first Doctrine entity and "expose" that as an API Resource. It's time for some magic.

7:29
Upgrading to Symfony 7.4

…Pop over to our app and refresh the homepage to make sure everything's still running smoothly. Nice, 7.4 upgrade was a success! Next, we're going to update Doctrine and explore a cool improvement in the latest version of the ORM. Stay tuned!

5:31
Autoconfiguration

…configuration, and environments. We are powerful! No, unstoppable. In the next tutorial, we'll introduce Doctrine - the industry standard way to work with databases in PHP. Until then practice. Go build something - anything - and tell us about it. And if you have any questions, thoughts…

8:36
Multiple Submit Buttons

…it also guesses field type options. For example, if a Doctrine entity property is nullable: true like for this notes field: Then Symfony will automatically make it optional. And the reverse for the other fields, the required HTML attribute will be added if the field…

6:45
Submitting a Form via GET

…install and configure it, build form types, render them with Twig helper functions, and handle submissions the right way with Form::handleRequest(). We've looked at how forms link up with Doctrine entities, how validation works, how to customize fields and attributes, and how to…

6:13
The Serializer

…methods. Cool! This will also cause the column in my database to change... so spin over to your console and run: symfony console make:migration I'll live dangerously and run that immediately: symfony console doctrine:migrations:migrate Done! Thanks to that rename... over in…

9:08
Using GROUP BY to Fetch & Count in 1 Query

… Only 1 query! Yo friends, we did it! Woo! Thanks for joining me on this magical ride through all things Doctrine Query. This stuff is just weird, cool and fun. I hope you enjoyed it as much as I did. If you encounter any crazy…

6:29
Selecting Specific Fields

…back from Doctrine is the ideal situation because... objects are just really nice to work with. But at the end of the day, if you need to query for specific data or columns, you can totally do that. And as we just saw, Doctrine will…

5:09
Test Environment Database Setup

…page... it's not using the DATABASE_URL from my .env: it's using the dynamic value that's set by the symfony binary. This is something that we talked about in our Doctrine tutorial. However, that magic is clearly not happening in our test…

9:30
Querying Classes

…setParameter(), for the second argument, use $this->getEntityManager()->getClassMetadata(Scout::class). This returns a special metadata object for the Scout class and is what Doctrine needs to properly handle the INSTANCE OF operator with parameters. Refresh the browser... and nice, just the scouts again! Try…

5:48
Subresources

…FROM dragon_treasure WHERE owner_id = whatever we pass for {user_id}. It knows how to make that query by looking at the Doctrine relationship and figuring out which column to use. It's super smart. We can actually see this in the profiler…

9:54
Hello Integration Tests!

…LockDownRepository(). But, hmm. LockDownRepository extends ServiceEntityRepository, which extends another class from Doctrine. If you look, to instantiate it, we need to pass a ManagerRegistry from Doctrine. And if you hold "command" or "control" and click into this... and go to the base class, it gets…

7:41
Composer

doctrine/dbal package and added it. With the require command, you can search for the package you need and Composer will automatically update your composer.json for you and run the update command to download the library. In this case, when I included the doctrine

14:00
Generating the API Token & Fixtures

…Instead, since every user will already have some API tokens in the database, we can jump straight to learning how to read and validate those tokens. Reload the fixtures with: symfony console doctrine:fixtures:load And... beautiful! But since we're not going to build…

5:58
Bootstrapping a Killer Test System

…in the test environment, we're missing the database. We could easily fix this by running: symfony console doctrine:database:create --env=test But that's way too much work. Instead, add one more trait to our test class: use ResetDatabase: This comes from Foundry: the…

8:18
Token Types & The ApiToken Entity

…console make:migration Spin over and peek at that file to make sure it looks good. Yup! It creates the api_token table: Run that with: symfony console doctrine:migrations:migrate And... awesome! Next: let's add a way to generate the random token string…

5:59
Pushing & Pulling Translations

…We'll need to rely on a third-party solution for that. A popular one is this Doctrine Extensions package. It has a "Translatable" behavior that allows you to translate your entities. There's also a Symfony Bundle to wire it all up. It works…

4:21