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

[9.x] Allows object instead of array when adding to PendingBatch #41475

Merged
merged 1 commit into from
Mar 16, 2022
Merged

[9.x] Allows object instead of array when adding to PendingBatch #41475

merged 1 commit into from
Mar 16, 2022

Conversation

yoeriboven
Copy link
Contributor

Currently you need to pass an array when you want to add to a batch.

$batch = Bus::batch([]);
$batch->add([new Job]);
$batch->dispatch();

With this PR you can do this:

$batch = Bus::batch([]);
$batch->add(new Job);
$batch->dispatch();

This is already possible if you want to add to an already dispatched batch:

$this->batch()->add(new Job);

The add function on PendingBatch wasn't tested yet either so I added a test.

@GrahamCampbell GrahamCampbell marked this pull request as draft March 14, 2022 15:17
@yoeriboven yoeriboven marked this pull request as ready for review March 16, 2022 14:44
@taylorotwell taylorotwell merged commit d10ab79 into laravel:9.x Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants