-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '4.2' into merge-4.1-into-4.2-1710254470287
* 4.2: PHPORM-139 Implement `Model::createOrFirst()` using `findOneAndUpdate` operation (#2742) Test Laravel 10 and 11 (#2746) PHPORM-150 Run CI on Laravel 11 (#2735) PHPORM-152 Fix tests for Carbon 3 (#2733)
- Loading branch information
Showing
9 changed files
with
157 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MongoDB\Laravel\Internal; | ||
|
||
use MongoDB\Driver\Monitoring\CommandFailedEvent; | ||
use MongoDB\Driver\Monitoring\CommandStartedEvent; | ||
use MongoDB\Driver\Monitoring\CommandSubscriber; | ||
use MongoDB\Driver\Monitoring\CommandSucceededEvent; | ||
|
||
/** | ||
* Track findAndModify command events to detect when a document is inserted or | ||
* updated. | ||
* | ||
* @internal | ||
*/ | ||
final class FindAndModifyCommandSubscriber implements CommandSubscriber | ||
{ | ||
public bool $created; | ||
|
||
public function commandFailed(CommandFailedEvent $event) | ||
{ | ||
} | ||
|
||
public function commandStarted(CommandStartedEvent $event) | ||
{ | ||
} | ||
|
||
public function commandSucceeded(CommandSucceededEvent $event) | ||
{ | ||
$this->created = ! $event->getReply()->lastErrorObject->updatedExisting; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters