2725 search results for Doctrine

Integration Tests

... you mock everything... there's nothing really left to test For example, how would you test that a complex query in a Doctrine repository works? If you mock the database connection then... I guess you could test that the ...

9:18
Prime Time with Messenger Queues Workers more Fun Ryan Weaver

... there's people like Tobias Nyholm uses that all the time. So in his handlers, he just kind of writes doctrine code and there's something else that wraps that in a transaction and then commits the transaction afterwards. Um ...

44:36
Relating Custom ApiResources

... it reads the Doctrine relationship metadata to figure out that a property is a collection of some other #[ApiResource] object. Long story short, this is simple to fix... it's just hard to understand at first. Above the ...

5:13
Setup Ways to Extend API Platform

... been Doctrine entities. And that's fine! But as your API starts to look different from your entities, making that work adds complexity: serialization groups, extending normalizers, etc. At some point, it becomes easier and ...

4:39
A World without Build Systems

... .. hello Mixed Vinyl! But wow is this thing weird and ugly-looking. This is a Symfony 6.3 project - the same project we've built in the Symfony series. It has Doctrine installed... but there's nothing particularly special ...

4:04
Reusing Queries in the Query Builder

... (make sure you get the one from Doctrine\ORM - the "Object Relational Mapper"), and let's call it $qb. This will also return a QueryBuilder. The next step is pretty simple. Go steal the JOIN logic from above... and, down ...

4:42
Totally Custom Fields

... with a state provider. We haven't talked about state providers yet, but they're how data is loaded. For example, our classes are already using a Doctrine state provider behind the scenes to query the database. We'll cover ...

3:24
Removing Items from a Collection

... property. After cascade, add one more option here: orphanRemoval: true. This tells Doctrine that if any of these dragonTreasures become "orphaned" - meaning they no longer have any owner - they should be deleted. Let's try it ...

3:49
Docker Environment Variables

... symfony var:export --multiline But the most important one by far is DATABASE_URL. Ok: Doctrine is configured! Next, let's create the database itself via a bin/console command. When we do that, we'll learn a trick for doing this with the environment variables from the Symfony binary.

3:43
MakerBundle Autoconfiguration

... make section. Ooh. There's a ton of stuff here for setting up security, generating doctrine entities for the database (which we'll do in the next tutorial), making a CRUD, and much more. Let's try one: how about we try to ...

4:27
Recipe Upgrades Part 2

Run: composer recipes:update Next up is doctrine-extensions-bundle. This one... when we look... just modified a comment! Easy!. So commit that... and then move onto debug-bundle ...

5:50
Annotations to Attributes

... Next, let's add property types to our entities. That's going to allow us to have less entity config thanks to a new feature in Doctrine.

5:14
QuestionTag Fixtures DateTimeImmutable with Faker

... datetime_immutable Doctrine type. This means that, instead of that property being a DateTime object, it will be a DateTimeImmutable object. Really... the same thing... except that DateTimeImmutable objects can't be changed. The ...

4:07
JOINing Across Multiple Relationships

... Question and Tag. Doing that is legal in SQL... but it messes up how Doctrine creates the objects, so it doesn't allow it. The solution is easy enough: select both. You can actually pass an array to addSelect() to select ...

3:52
Foundry Always Pass a Factory Instance to a Relation

I love Foundry. But using Foundry with Doctrine relationships is probably the hardest part of this library. So let's push a bit further. Pretend that, in this situation, we want to override the question value. Right now ...

4:57
Mercure Pushing Stream Updates Async

... yet! That's like installing Doctrine... but without MySQL or Postgresql running! So next, let's get the Mercure service running. There are a bunch of ways to do this. But if you're using the Symfony binary web server like we are... then... it's already done!

4:43
UUID as a API Identifier

... And when you use Doctrine, API Platform assumes that you want the database id as the identifier. To tell it to use something different, add @ApiProperty() with identifier=false: That says: Hey! Please don't use this ...

5:16
Core Listeners Accessing the Resource Objects

... the isMe field... that's probably fine... because nobody is the currently-authenticated user in a console command anyways. But if you did want a custom field to be populated everywhere - even in a console command - we have one more solution: a Doctrine postLoad listener. Let's check that out next!

4:37
How does the Controller Access the Container

... ServiceSubscriberInterface. This is actually something we talk about in one of our Doctrine tutorials. When you implement ServiceSubscriberInterface, it forces you to have a method called getSubscribedServices() where ...

4:14
Prod Vault Optimization Vault for Tests

... feature called "validation auto mapping". It's a wicked-smart feature that automatically adds validation constraints based on your Doctrine metadata and also based on the way that your PHP code is written in your class.

4:53