File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -644,6 +644,15 @@ also generated a ``removeProduct()`` method::
644644Thanks to this, if you call ``$category->removeProduct($product) ``, the ``category_id ``
645645on that ``Product `` will be set to ``null `` in the database.
646646
647+ .. warning ::
648+
649+ Please be aware that the inverse side could be associated with a large amount of records.
650+ I.e. there could be a large amount of products with the same category.
651+ In this case ``$this->products->contains($product) `` could lead to unwanted database
652+ requests and very high memory consumption with the risk of hard to debug "Out of memory" errors.
653+
654+ So make sure if you need an inverse side and check if the generated code could lead to such issues.
655+
647656But, instead of setting the ``category_id `` to null, what if you want the ``Product ``
648657to be *deleted * if it becomes "orphaned" (i.e. without a ``Category ``)? To choose
649658that behavior, use the `orphanRemoval `_ option inside ``Category ``:
You can’t perform that action at this time.
0 commit comments