Skip to content

delete status #48

Closed
Closed

Description

@BLLuis

Would be cool to return the count of deleted records. I do a fetch before to know the number of records that will be deleted.

Activity

  1. added
    enhancement
    on Nov 18, 2020
  2. rakibtg commented on Nov 20, 2020

    @rakibtg
    Member

    @BLLuis Hi! Can you show an example of how you would like to consume the delete status method in the query?

  3. BLLuis commented on Nov 21, 2020

    @BLLuis
    Author

    Hi, something like this:

    $deletedCount = $store->blahblah->delete();
    print_r($deletedCount . " registers removed");

    Simple as "return the count of deleted records".
    Thanks

  4. Timu57 commented on Nov 21, 2020

    @Timu57
    Member

    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.

  5. rakibtg commented on Nov 22, 2020

    @rakibtg
    Member

    @Timu57 I will add an optional parameter:

    delete($returnRecordsCount); // true or false

    If $returnRecordsCount = true then it will return total amount of items deleted. Or true/false by default.

  6. added 2 commits that reference this issue on Nov 22, 2020
  7. self-assigned this
    on Nov 22, 2020
  8. BLLuis commented on Nov 22, 2020

    @BLLuis
    Author

    Nice.

  9. added this to the Version 2.0 milestone on Jan 11, 2021
  10. rakibtg commented on Jan 24, 2021

    @rakibtg
    Member

    Added in SleekDB 2.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementrelease candidate

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions