Last active
January 24, 2025 09:38
-
-
Save janedbal/f4dea14a76e54ef6ea930234b1357d02 to your computer and use it in GitHub Desktop.
Revisions
-
janedbal renamed this gist
Jan 24, 2025 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ <?php // see https://github.com/shipmonk-rnd/doctrine-two-phase-migrations/issues/97 // composer require nette/utils require __DIR__ . '/../vendor/autoload.php'; -
janedbal created this gist
Aug 12, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ <?php // composer require nette/utils require __DIR__ . '/../vendor/autoload.php'; /** @var SplFileInfo $file */ foreach (\Nette\Utils\Finder::findFiles('*.php')->in(__DIR__ . '/../migrations') as $file) { $contents = \Nette\Utils\FileSystem::read($file->getPathname()); $newContents = str_replace([ 'use Doctrine\Migrations\AbstractMigration;', 'extends AbstractMigration', 'public function up(Schema $schema): void', 'public function down(Schema $schema): void', '$this->addSql', ], [ 'use ShipMonk\Doctrine\Migration\Migration;', 'implements Migration', 'public function before(\Doctrine\DBAL\Connection $connection): void', 'public function after(\Doctrine\DBAL\Connection $connection): void', '$connection->executeQuery', ], $contents ); \Nette\Utils\FileSystem::write($file->getPathname(), $newContents); }