Open adkurz opened 4 years ago
Sorry, not erase, but find in the before the foreach loop.
This cannot be fixed that way, because the erase query does not return the ID's of affected / deleted rows. So we would end up with preloading all records that should be deleted, run the beforeease and then decide if it should be deleted or not... which then is the same method you're already using, so it wont be any faster. If you pass a $filter to the erase method, the beforeerase handler is ignored because of that, as state here https://fatfreeframework.com/3.7/sql-mapper#erase If you have an idea how to solve that more efficiently, I'm all ears.
I have some tables with 1-n-relations. To delete them without any foreign key problems, al these models have onerase in their constructors. Example:
Model Item:
If I now want to erase a category, like $category->load(...), $category->erase(), The onerase function of the category-model is triggered, but not the onerase function of the items. If I use a foreach loop instead, it works, but is slow:
Could you please fix this problem?