Closed AndyCamicci closed 6 years ago
Sorry, found a solution, it's in the easy_admin.yaml configuration with the by_reference
option
easy_admin:
entities:
Category:
class: App\Entity\Category
form:
fields:
- { property: 'name' }
- { property: 'products', type_options: { by_reference: false } }
Product:
class: App\Entity\Product
Sorry but I have the same problem and same with
- { property: 'products', type_options: { by_reference: false } }
Does'nt work.
Any idea ?
This helped me. Thanks.
@CaptainJojo What is the name of your field? Is it really products
?
Hi, first of all, a big thanks for this awesome bundle !
However, something seems not to work properly. I have read #1663, #1447 and #1446 but my problem is slightly different, and none of the solutions worked for me.
I started a Symfony4 project, added Doctrine and EasyAdmin (1.17.7). I have a very (very) basic configuration.
They both are very simple, generated by Make and/or copy/paste from the official documentation here : https://symfony.com/doc/current/doctrine/associations.html
Here is my Category.php
And my Product.php
On my easy_admin.yaml config file, i just have
(Almost) everything works fine, except when i try to edit a category.
Let's say i create a category Cat1, and two products Product1 and Product2, both having Cat1 as the category.
If i edit Cat1, and i try to remove Product2, it doesn't work. If i try to also change the name of the category at the same time, the name get's updated, but not the associated products.
I do have the
addProduct
andremoveProduct
functions, i do NOT want to addorphanRemoval=true
because in this case, it is working but delete completely the product, which is not what i want. I would like to simply set the product's category to null (and yes, the field is nullable).Can someone help me or point out what i am doing wrong ? Thank you again ! 👍