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 @@ -581,6 +581,15 @@ also generated a ``removeProduct()`` method::
581581Thanks to this, if you call ``$category->removeProduct($product) ``, the ``category_id ``
582582on that ``Product `` will be set to ``null `` in the database.
583583
584+ .. warning ::
585+
586+ Please be aware that the inverse side could be associated with a large amount of records.
587+ I.e. there could be a large amount of products with the same category.
588+ In this case ``$this->products->contains($product) `` could lead to unwanted database
589+ requests and very high memory consumption with the risk of hard to debug "Out of memory" errors.
590+
591+ So make sure if you need an inverse side and check if the generated code could lead to such issues.
592+
584593But, instead of setting the ``category_id `` to null, what if you want the ``Product ``
585594to be *deleted * if it becomes "orphaned" (i.e. without a ``Category ``)? To choose
586595that behavior, use the `orphanRemoval `_ option inside ``Category ``:
You can’t perform that action at this time.
0 commit comments