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?
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
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.
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.
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.
Very well explained and very helpful. Thanks!
Thanks Michael...I appreciate it!
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?
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
Ctrl + enter pulls up the menu
Then just select getters and setters...then choose the properties you want to create for
Thanks for video, it helped me understand topic :)
Great to hear!
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.
Yes mappedBy..and all the annotations are a Doctrine thing...not directly Symfony related.
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.
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.
@@RomskieL Great stuff...I'm glad you managed to figure it out..well done!
Is there a way to setup a relation only by id? (in that case manufacturer_id)
It's all fairly configurable. I stick to common conventions as much as I can.
thx