I'm able to fetch the single items, or the whole tables via the $modelFactory->create()->load(ID)
or $modelFactory->create()->getCollection()
Using the $modelFactory, how can I delete all the data fetched?
---- UPDATE ----
The code I'm using at the moment is the following one. I guess it's running a query per item, instead of doing one query for all the items, so I'm looking for a way to do it in one single shot.
$cleanup = $this->myModelFactory->create()->getCollection();
foreach($cleanup as $item) {
$item->delete();
}
$cleanup
has 50 items, the foreach loop will generate 50 SQL delete query instead of one with all the items to delete.