This commit is contained in:
Xes
2025-08-14 22:41:49 +02:00
parent 2de81ccc46
commit 8ce45119b6
39774 changed files with 4309466 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace Doctrine\DBAL\Migrations\Event\Listeners;
use Doctrine\Common\EventSubscriber;
use Doctrine\DBAL\Migrations\Events;
use Doctrine\DBAL\Migrations\Event\MigrationsEventArgs;
/**
* Listens for `onMigrationsMigrated` and, if the conneciton is has autocommit
* makes sure to do the final commit to ensure changes stick around.
*
* @since 1.6
*/
final class AutoCommitListener implements EventSubscriber
{
public function onMigrationsMigrated(MigrationsEventArgs $args)
{
$conn = $args->getConnection();
if ( ! $args->isDryRun() && ! $conn->isAutoCommit()) {
$conn->commit();
}
}
/**
* {@inheritdoc}
*/
public function getSubscribedEvents()
{
return [Events::onMigrationsMigrated];
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace Doctrine\DBAL\Migrations\Event;
use Doctrine\Common\EventArgs;
use Doctrine\DBAL\Migrations\Configuration\Configuration;
class MigrationsEventArgs extends EventArgs
{
/**
* @var Configuration
*/
private $config;
/**
* The direction of the migration.
*
* @var string (up|down)
*/
private $direction;
/**
* Whether or not the migrations are executing in dry run mode.
*
* @var bool
*/
private $dryRun;
public function __construct(Configuration $config, $direction, $dryRun)
{
$this->config = $config;
$this->direction = $direction;
$this->dryRun = (bool) $dryRun;
}
public function getConfiguration()
{
return $this->config;
}
public function getConnection()
{
return $this->config->getConnection();
}
public function getDirection()
{
return $this->direction;
}
public function isDryRun()
{
return $this->dryRun;
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Doctrine\DBAL\Migrations\Event;
use Doctrine\DBAL\Migrations\Configuration\Configuration;
use Doctrine\DBAL\Migrations\Version;
class MigrationsVersionEventArgs extends MigrationsEventArgs
{
/**
* The version the event pertains to.
*
* @var Version
*/
private $version;
public function __construct(Version $version, Configuration $config, $direction, $dryRun)
{
parent::__construct($config, $direction, $dryRun);
$this->version = $version;
}
public function getVersion()
{
return $this->version;
}
}