1000 search results

Hooking up the Scientist Removal JavaScript

…Mixed in with AJAX call for notes is our DELETE call. Click the little sha, then go to the Doctrine tab. Ooh, look at this: DELETE FROM genus_scientist WHERE genus_id = 11 AND user_id = 11 Gosh darn it that's nice…

2:50
ManyToMany Relationship

…thing is that it will hold the array of User objects that are linked to this Genus: Above, add the annotation: @ORM\ManyToMany with targetEntity="User". Finally, whenever you have a Doctrine relationship where your property is an array of items, so, ManyToMany and OneToMany…

5:18
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
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
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
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
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
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
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
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
Auto-complete Association Field & Controlling the Query

…debug toolbar... hover over the AJAX section and click to open the profiler. You're now looking at the profiler for the autocomplete AJAX call. Head over to Doctrine section so we can see what that query looks like. Here it is. Click "View formatted…

5:36
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
Finding & Eliminating Deprecations

…at the end, it references an issue from the doctrine/orm repository. Ah! This deprecation isn't coming from Symfony: it's coming from doctrine/orm! This tells us that we're going to need to make a change to our code - at some point…

6:16
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