Skip to content

[12.x] Pipeline::withinTransaction() accepts connection #56550

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

Merged
merged 5 commits into from
Aug 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix up
  • Loading branch information
cosmastech committed Aug 6, 2025
commit db9e55592344bf1f61d0c0a4d661a7a4be04d7c9
5 changes: 2 additions & 3 deletions src/Illuminate/Pipeline/Pipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Pipeline\Pipeline as PipelineContract;
use Illuminate\Support\Traits\Conditionable;
use UnitEnum;
use RuntimeException;
use Throwable;

Expand Down Expand Up @@ -258,10 +257,10 @@ protected function pipes()
/**
* Execute each pipeline step within a database transaction.
*
* @param string|null|\UnitEnum|false $withinTransactions
* @param string|null|\UnitEnum|false $withinTransaction
* @return $this
*/
public function withinTransactions($withinTransaction = null)
public function withinTransaction($withinTransaction = null)
{
$this->withinTransaction = $withinTransaction;

Expand Down
6 changes: 3 additions & 3 deletions tests/Pipeline/PipelineTransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function testPipelineTransaction()
{
Event::fake();

$result = Pipeline::withinTransactions()
$result = Pipeline::withinTransaction()
->send('some string')
->through([
fn ($value, $next) => $next($value),
Expand Down Expand Up @@ -46,7 +46,7 @@ public function testConnection($connection, $connectionName)
config(['database.connections.testing2' => config('database.connections.testing')]);
config(['database.default' => 'testing2']);

$result = Pipeline::withinTransactions($connection)
$result = Pipeline::withinTransaction($connection)
->send('some string')
->through([
function ($value, $next) {
Expand All @@ -67,7 +67,7 @@ public function testExceptionThrownRollsBackTransaction()

$finallyRan = false;
try {
Pipeline::withinTransactions()
Pipeline::withinTransaction()
->send('some string')
->through([
function ($value, $next) {
Expand Down