Thread ancestors not updated when using delete cascades
Martin1982 opened this issue · comments
I'm working on a feature where users can remove their account and data (in accordance with GDPR regulations). For this when an author deletes their account their comments are removed with an onDelete="CASCADE" on this column.
In general this works great, until someone has a reply in a comment tree, the ancestor column saves the id's with a slash-delimiter. Once a page with a thread is visited and one of these id's doesn't exist anymore an error is thrown;
Notice: Undefined offset: 3
In the file vendor/friendsofsymfony/comment-bundle/Model/Tree.php (line 62)
It would be nice to have an exception thrown here which can be caught. And it would even be greater if the slash delimited ancestors value can be regenerated upon this exception when it's caught.