Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reoccurring Events Not Returned Using "->Batch()" Element Query #255

Closed
darinlarimore opened this issue Jan 26, 2024 · 2 comments · Fixed by #277
Closed

Reoccurring Events Not Returned Using "->Batch()" Element Query #255

darinlarimore opened this issue Jan 26, 2024 · 2 comments · Fixed by #277
Assignees
Labels
issue Something isn't working correctly

Comments

@darinlarimore
Copy link

Describe the bug or issue you're experiencing
When using a ->batch() event element query, reoccurring events are not returned.
When using ->all() the reoccurring events are returned.

Steps to reproduce

$all = Event::find()->setLoadOccurrences(true)->count();

// Dump event count not using batch
dump($all);

$batch = Event::find()->setLoadOccurrences(true)->batch(25);

$count = 0;
foreach ($batch as $key => $events) {
    $count += count($events);
}

// Dump all events using batch
dd($count);

Expected behavior
The events returned using a ->batch() query should include reoccurring events.

Craft & Plugin Info (please complete the following information):

  • Craft Version: 4.5.6.1
  • Calendar Version: 4.0.9
  • Calendar Edition: Pro
  • Fresh Install or Upgrade: Fresh Install

Additional context
The "studioespresso/craft-scout" plugin uses batch to query for indexing. This is where we first noticed the issue.

@darinlarimore darinlarimore added the issue Something isn't working correctly label Jan 26, 2024
@seandelaney
Copy link
Contributor

seandelaney commented Apr 4, 2024

I added 4 events, 3 recurring.

all returns 8 in total for me.

If I call the following:

$query = \Solspace\Calendar\Elements\Event::find()->setLoadOccurrences(true);
$count = 0;
foreach ($query->batch(25) as $batch) {
   $count =+ count($batch);
   foreach ($batch as $event) {
      // Do something with $event;
      // dd($event); // Prints out Solspace\Calendar\Elements\Event object for me.
   }
}
dd($count); // Prints out 4 for me.

I will investigate why recurring events are not returning.

@kjmartens
Copy link
Contributor

This should be resolved in Calendar 5.0.4. 🙂

We'll likely be able to get a Calendar 4.x fix available soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue Something isn't working correctly
Development

Successfully merging a pull request may close this issue.

3 participants