Do not count deleted entities !? ( elgg 1.7 )

Hello,
I wrote
this function to count and compare two different entities:

$count_myent1s = count_user_objects($user->guid, "myent1", false);
$myent1s = get_user_objects($user->guid, "myent1", false, 99);
           if (!empty($vars['entity']->name)) {
           $i = 1;
           foreach ($myent1s as $ent) {
            if (($ent->name) === ($vars['entity']->name)) {
                 echo $i;
                $i++; }
           
           }
           }
The problem I have is that this function counts the entities that have been deleted!? ... how to make these entities are not snuff into account in my office?
Thanks ;)
  • If the delete function is properly coded, it will remove that content entirely. What exactly you mean by "counts the entities that have been deleted!?" Make sure your code for deletion is a proper one.

  • Hello Team Webgalli,
    When I say
    "counts the Entities That Have Been deleted!?"  Is in fact my function that compares continues to show the same results when I removed an object instance. I'll go see if they are still contained in my database, and then I would see to remove cleanly.

  • Tomaw,

    remember that the only way to delete an Elgg entity is:

    $entity->delete();

    In Elgg an entity has components scattered across multiple tables and the database should never be accessed directly.

  • Kevin is right. Elgg entity data and its comments, relations all are in different tabls. Whatever action you are doing on elgg, do it through elgg functions.