Doctrine ORM One to Many Relationship (bidirectional)

  Рет қаралды 17,291

Gary Clarke

Gary Clarke

Күн бұрын

Пікірлер: 20
@olegandru9522
@olegandru9522 Жыл бұрын
Hello. I want to get the products as they are at 15:06, but I saw that each product has a "manufacturer" property, which contains a "Manufacturer" object (after the id, name). But if I expand this Manufacturer object, then it contains a complete list of products, because the manufacturer class has the inverse property relation of products products(5:22).... But in the list of products (15:06) I do NOT need a list of all products again loaded in each Manufacturer object (If we expand this object, we will see the products property which is an array of products). This is strange, because it turns out that we get an array of products, and inside each product we again load the full list of products (because it is in each Manufacturer in the product). Can I get a list of all the manufacturer's products without duplicating the products inside the Manufactor object?
@flair03
@flair03 4 жыл бұрын
Very well explained and very helpful. Thanks!
@GaryClarkeTech
@GaryClarkeTech 4 жыл бұрын
Thanks Michael...I appreciate it!
@RomskieL
@RomskieL 2 жыл бұрын
I'm currently trying this out in Symfony 6. The cascade={"persist"} will give me an error, so I tried cascade: ['persist']. It didn't give me an error, but it won't cascade in saving the child. I still need to persist the parent and persist also the child to save them both into the db.
@RomskieL
@RomskieL 2 жыл бұрын
I got it now. Instead of adding the parent to the child: $child->setParent($parent), I added the child to the parent: $parent->addChild($child). It then cascaded the persist.
@GaryClarkeTech
@GaryClarkeTech 2 жыл бұрын
@@RomskieL Great stuff...I'm glad you managed to figure it out..well done!
@MrWilde
@MrWilde 3 жыл бұрын
I was under the impression there is no functionality difference between Symfony 5 and 4, just the deprecated items removed in 5. There are some things I saw in this vide not in Symfony 4, liked the mappedBy in the oneToMany relationShip. Is this more of a doctrine version issue? Just an FYI the content is great but it is a ittle hard to follow, jumping between pages very quickly and editing code and the bottom of the page can be hard to see. Just some feedback, but the content is really good.
@GaryClarkeTech
@GaryClarkeTech 3 жыл бұрын
Yes mappedBy..and all the annotations are a Doctrine thing...not directly Symfony related.
@amirkhan-vm7pt
@amirkhan-vm7pt 23 күн бұрын
is there any github repo for this course?
@GaryClarkeTech
@GaryClarkeTech 7 күн бұрын
No..it was from before I used to maintain accompanying repo's. All my recent courses have repos.
@Hunterrr15
@Hunterrr15 3 жыл бұрын
Thanks for video, it helped me understand topic :)
@GaryClarkeTech
@GaryClarkeTech 3 жыл бұрын
Great to hear!
@lorandgyorgy-fazakas11
@lorandgyorgy-fazakas11 2 жыл бұрын
Is there a way to setup a relation only by id? (in that case manufacturer_id)
@GaryClarkeTech
@GaryClarkeTech 2 жыл бұрын
It's all fairly configurable. I stick to common conventions as much as I can.
@CaimAstraea
@CaimAstraea 3 жыл бұрын
What shortcut did you use for getters and setters in phpstorm ? The shortest path I could find was cmd + N but I still have an extra step while you jumped straight into the window :D
@GaryClarkeTech
@GaryClarkeTech 3 жыл бұрын
Ctrl + enter pulls up the menu Then just select getters and setters...then choose the properties you want to create for
@TheMefizz
@TheMefizz 3 жыл бұрын
thx
Doctrine ORM Many to One Unidirectional Relationship
6:38
Gary Clarke
Рет қаралды 2,9 М.
Doctrine ORM: Entity, Identity Map, Unit Of Work
47:29
R class Tech
Рет қаралды 4,2 М.
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
Doctrine ORM Many to Many Relationship
10:26
Gary Clarke
Рет қаралды 7 М.
Doctrine ORM - PHP Entities & Data Mapper Pattern - Full PHP 8 Tutorial
26:18
Symfony 5 : Inheritance Mapping / Polymorphic relationship? (Example)
14:03
Django ORM Deep Dive - Introduction to Databases & SQL
29:18
BugBytes
Рет қаралды 30 М.
Prisma, Eloquent, Doctrine: Why Use an ORM?
3:30
Kodaps Academy
Рет қаралды 8 М.
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН