1000 search results

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
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
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
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
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
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
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
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
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
Investigating & Retrying Failed Messages

…AMQP or Redis - support all of the features we just saw if you use it as your failure transport. That may change in the future, but at this moment - Doctrine is the most robust transport to use for failures. Anyways, as cool as failing is…

5:41
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
All About services.yaml

…with $product = new Product(). So, these will not be services in the container. In the next tutorial, we'll create Doctrine entity classes, which are model classes for the database. These will live in the src/Entity/ directory... and since they're not meant…

10:27
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
Always Remember Me & "signature_properties"

…s password in the database. We can cheat and do this on the command line: symfony console doctrine:query:sql 'UPDATE user SET password="foo" WHERE email = "abraca_admin@example.com"' Setting the password to foo is utter nonsense... since this column needs to…

6:28
Mercure: Pushing Stream Updates Async

…some PHP and JavaScript code that's going to help us communicate with Mercure. But... we don't actually have a Mercure service running yet! That's like installing Doctrine... but without MySQL or Postgresql running! So next, let's get the Mercure service running…

4:43
Flysystem & S3

…it should... just kinda work! The easiest way to find out is to reload the fixtures: php bin/console doctrine:fixtures:load And yes, I do recommend using S3 when developing locally if that's what you're using on production. You could change the…

7:44
Relating Custom ApiResources

…objects... which results in it just serializing all the properties. This isn't a problem with entities because the serializer is smart: it reads the Doctrine relationship metadata to figure out that a property is a collection of some other #[ApiResource] object. Long story short…

5:13
API Platform Installation!

…fake" library that helps install several thing at once. Heck, you can see this at https://github.com/api-platform/api-pack: it's a single composer.json file that requires several libraries, like Doctrine, a CORS bundle that we'll talk about later, annotations…

6:42
Serializing Messages as JSON

…the keys that you're allowed to have below each transport is called serializer. Set this to a special string: messenger.transport.symfony_serializer. When a message is sent to a transport - whether that's Doctrine, AMQP or something else - it uses a "serializer" to…

6:41