2709 search results for Doctrine

Adding Populating the Custom Field

... return $users: Back at the browser, find the original tab and refresh. Oh! It's not an array of users! It's a Paginator object with a Doctrine Paginator inside! So... this obviously isn't an array, but the Paginator ...

5:10
docker-compose Env Vars Symfony

... variable that Doctrine is looking for. I'll show you exactly what I mean. First, go back to your browser, watch the bottom right of the web debug toolbar, and refresh. Ah! The little "Server" icon turned green! This is ...

4:59
Upgrading/Migrating from StofDoctrineExtensions

... upgrade this the lazy way: find the package name and copy it: We're hoping a minor upgrade - maybe from 1.3 to 1.4 - will fix things. Update! composer update stof/doctrine-extensions ...

4:50
When Migrations Fail

My other favorite Doctrine Extension behavior is timestampable. Go back to the library's documentation and click to view the Timestampable docs. Oh, it's so nice: with this behavior, we can add $createdAt and $updatedAt ...

5:34
All about Entity Repositories

... class's repository, Doctrine should give us an instance of this ArticleRepository class: Oh, and the built-in find*() methods actually come from one of the parent classes of ArticleRepository. So... why the heck are we ...

5:35
Autowiring Deprecations

... EntityManagerInterface! But... there's another solution! If you want, it is totally ok to type-hint EntityManager. To make this work with autowiring, we can create an alias. Copy the Doctrine\ORM\EntityManager class name. Then ...

5:36
Selecting Specific Fields

... don't trust myself. So, var_dump($fortunesPrinted) in the controller with our trusty die statement: Refresh! Uh oh, that's an awesome error: This is what it looks like when you mess up your DQL. Doctrine does a really ...

5:04
Tests with the Container

... EntityManager. And that also means we have an easy way to clear data. Create a new private function called purgeDatabase(). Because we have the Doctrine DataFixtures library installed, we can use a great class called ...

4:23
Deleting an Item from a Collection orphanRemoval

... database? The problem is that the genusScientists property is now the inverse side of this relationship: In other words, if we remove or add a GenusScientist from this array, it doesn't make any difference! Doctrine ...

5:14
EntityType Checkboxes with ManyToMany

... field. The type will be EntityType: This is your go-to field type whenever you're working on a field that is mapped as any of the Doctrine relations. We used it earlier with subfamily. In that case, each Genus has only ...

5:39
Removing a ManyToMany Item

... object to the genusScientists property: So guess what? To remove that link and delete the row in the join table, we do the exact opposite: remove the User from the genusScientists property and save. Doctrine will ...

5:16
We 3 Creating Stripe Customers

... () method returns a Stripe\Customer object: And we like that because this object has an id property. To save that on our user record, say $user->setStripeCustomerId($customer->id): Then, I'll use Doctrine to run the UPDATE ...

4:37
Saving Users

... Doctrine\Common\DataFixtures\FixtureInterface; use Doctrine\Common\Persistence\ObjectManager; use Yoda\UserBundle\Entity\User; class LoadUsers implements FixtureInterface { } Saving users is almost easy: just create the ...

3:37
Flex Recipe Updates

... doing our real job. I'll hit enter to go down the list one-by-one. First up is Doctrine Bundle: and it's a complex update. It even caused a conflict! Sometimes we might see that a recipe update changes something - like ...

6:04
Testing Messenger

... Messenger: composer require symfony/messenger Lovely! In .env, this added a MESSENGER_TRANSPORT_DSN which, by default, uses the Doctrine transport type. Though, it won't matter ...

7:18
DTO Entity State Processor

... talked about what's happening: the JSON is deserialized into a UserApi object. Good! Then the core Doctrine PersistProcessor is called because that's the default processor when using stateOptions. But... because our UserApi ...

7:39
EXTRA_LAZY Relationships

... data.... just to count them... isn't the greatest thing for efficiency. If you find yourself in this situation, you can tell Doctrine to be clever with how it loads the relation. Go into the Category entity and find ...

6:07
Selecting Specific Fields

... Love it! Getting full entity objects 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 ...

5:09
andWhere and orWhere

... shouldn't either. Using andWhere() is always ok - even if this is the first WHERE clause... and we don't really need the "and" part. Doctrine is smart enough to figure that out. What's wrong with ->where()? Well, if you ...

7:06
Installing API Platform

... scroll down, it installed api-platform itself, Doctrine, since I didn't already have that, and some other packages. At the bottom... let's see... the doctrine-bundle recipe is asking us if we want to include a docker ...

7:29