Doctrine ORM One to Many Relationship (bidirectional)

preview_player
Показать описание


👇Follow me on Social Media:

💕Show support:
Рекомендации по теме
Комментарии
Автор

Very well explained and very helpful. Thanks!

flair
Автор

Thanks for video, it helped me understand topic :)

Hunterrr
Автор

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

CaimAstraea
Автор

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?

olegandru
Автор

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
Автор

Is there a way to setup a relation only by id? (in that case manufacturer_id)

lorandgyorgy-fazakas
Автор

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.

MrWilde