We have moved to Github. Please open tickets there.

Opened 2 years ago

Closed 17 months ago

#3271 closed Enhancement (wontfix)

Consider using ElggBatch automatically with getter funtions

Reported by: ewinslow Owned by:
Priority: normal Milestone: Needs Review
Component: Core Version: Github Master
Severity: minor Keywords:
Cc: brett@… Difficulty: easy

Description

That is, I want to be able to say elgg_get_entities(array('limit' => 'whatever')); and have that work w/out oom errors and without doing any extra fancies like "new ElggBatch".

Since ElggBatch expects these functions, we might run into a chicken and egg problem, but the solution would be to rename the current functions to something else and then elgg_get_entities* would simply be wrappers that use ElggBatch on these new functions.

Good idea? Bad idea?

Change History (5)

comment:1 Changed 2 years ago by cash

I prefer keeping it simple for the typical uses cases and pushing the complexity to those who need to do out of the ordinary stuff.

comment:2 Changed 2 years ago by brettp

I intended ElggBatch primarily to be used only internal for mass operations (like deleting all the metadata on an entity or sending notifications) or in upgrades. I don't think it should be the primary getter interface.

That said, I would still like to eventually (2.0) switch to something closer to ElggBatch....ElggRecordset() or something to let you do:

$constraints = array('type' => 'object', 'subtype' => 'blog');
$results = new ElggRecordset('entities', $constraints);
foreach ($results as $blog) {
    // code
}

comment:3 Changed 2 years ago by ewinslow

  • Milestone changed from Needs Review to Elgg 2.0

I didn't mean it would be the primary getter interface. elgg_get_entities* would still be the API functions for grabbing stuff. They would just use ElggBatch internally to keep the OOM fanciness away from plugin authors.

But anyways -- sounds like we want this kind of thing to wait for 2.0.

comment:4 Changed 20 months ago by cash

  • Milestone changed from Elgg 2.0 to Needs Review

I'm not convinced or maybe this ticket is going in a different direction than the original post.

comment:5 Changed 17 months ago by cash

  • Resolution set to wontfix
  • Status changed from new to closed

Needing to grab every instance of something is the exception rather than the norm. I think it is fine that we require plugin developers to explicitly use ElggBatch when working with large numbers of objects. The amount of work needed to rewrite the elgg_get_entities/ElggBatch so that ElggBatch does not depend on the elgg_get_entities is to much to justify the small gain of doing so.

Note: See TracTickets for help on using tickets.