You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But I am not sure if that is ok, because if we update this function to return a number instead of a boolean value it would not be compatible any more with legacy code.
Activity
rakibtg commentedon Nov 20, 2020
@BLLuis Hi! Can you show an example of how you would like to consume the delete status method in the query?
BLLuis commentedon Nov 21, 2020
Hi, something like this:
$deletedCount = $store->blahblah->delete();
print_r($deletedCount . " registers removed");
Simple as "return the count of deleted records".
Thanks
Timu57 commentedon Nov 21, 2020
We could provide this functionality very easy by adding a counter-variable to the delete function and incrementing it with this loop:
https://github.com/rakibtg/SleekDB/blob/9f4c2d95fcb7871955c066dc455a52165d2099dd/src/SleekDB.php#L227
But I am not sure if that is ok, because if we update this function to return a number instead of a boolean value it would not be compatible any more with legacy code.
rakibtg commentedon Nov 22, 2020
@Timu57 I will add an optional parameter:
If
$returnRecordsCount = truethen it will return total amount of items deleted. Or true/false by default.#48 Return the count of deleted records
Merge pull request #53 from rakibtg/feature/48-CountDeletedRecords
BLLuis commentedon Nov 22, 2020
Nice.
rakibtg commentedon Jan 24, 2021
Added in SleekDB 2.0!