Capsule
2 years ago
Concerns
2 years ago
Connectors
2 years ago
Console
2 years ago
DBAL
2 years ago
Eloquent
2 years ago
Events
2 years ago
Migrations
2 years ago
PDO
2 years ago
Query
2 years ago
Schema
2 years ago
ClassMorphViolationException.php
2 years ago
ConfigurationUrlParser.php
2 years ago
Connection.php
2 years ago
ConnectionInterface.php
2 years ago
ConnectionResolver.php
2 years ago
ConnectionResolverInterface.php
2 years ago
DatabaseManager.php
2 years ago
DatabaseServiceProvider.php
2 years ago
DatabaseTransactionRecord.php
2 years ago
DatabaseTransactionsManager.php
2 years ago
DetectsConcurrencyErrors.php
2 years ago
DetectsLostConnections.php
2 years ago
Grammar.php
2 years ago
LazyLoadingViolationException.php
2 years ago
MigrationServiceProvider.php
2 years ago
MultipleRecordsFoundException.php
2 years ago
MySqlConnection.php
2 years ago
PostgresConnection.php
2 years ago
QueryException.php
2 years ago
RecordsNotFoundException.php
2 years ago
SQLiteConnection.php
2 years ago
Seeder.php
2 years ago
SqlServerConnection.php
2 years ago
DatabaseTransactionRecord.php
69 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP_SCOPED\Illuminate\Database; |
| 4 | |
| 5 | /** @internal */ |
| 6 | class DatabaseTransactionRecord |
| 7 | { |
| 8 | /** |
| 9 | * The name of the database connection. |
| 10 | * |
| 11 | * @var string |
| 12 | */ |
| 13 | public $connection; |
| 14 | /** |
| 15 | * The transaction level. |
| 16 | * |
| 17 | * @var int |
| 18 | */ |
| 19 | public $level; |
| 20 | /** |
| 21 | * The callbacks that should be executed after committing. |
| 22 | * |
| 23 | * @var array |
| 24 | */ |
| 25 | protected $callbacks = []; |
| 26 | /** |
| 27 | * Create a new database transaction record instance. |
| 28 | * |
| 29 | * @param string $connection |
| 30 | * @param int $level |
| 31 | * @return void |
| 32 | */ |
| 33 | public function __construct($connection, $level) |
| 34 | { |
| 35 | $this->connection = $connection; |
| 36 | $this->level = $level; |
| 37 | } |
| 38 | /** |
| 39 | * Register a callback to be executed after committing. |
| 40 | * |
| 41 | * @param callable $callback |
| 42 | * @return void |
| 43 | */ |
| 44 | public function addCallback($callback) |
| 45 | { |
| 46 | $this->callbacks[] = $callback; |
| 47 | } |
| 48 | /** |
| 49 | * Execute all of the callbacks. |
| 50 | * |
| 51 | * @return void |
| 52 | */ |
| 53 | public function executeCallbacks() |
| 54 | { |
| 55 | foreach ($this->callbacks as $callback) { |
| 56 | \call_user_func($callback); |
| 57 | } |
| 58 | } |
| 59 | /** |
| 60 | * Get all of the callbacks. |
| 61 | * |
| 62 | * @return array |
| 63 | */ |
| 64 | public function getCallbacks() |
| 65 | { |
| 66 | return $this->callbacks; |
| 67 | } |
| 68 | } |
| 69 |