16
16
use Doctrine \Migrations \MigratorConfiguration ;
17
17
use Doctrine \Migrations \ParameterFormatter ;
18
18
use Doctrine \Migrations \Provider \SchemaDiffProvider ;
19
+ use Doctrine \Migrations \Query \Query ;
19
20
use Doctrine \Migrations \Stopwatch ;
20
21
use Doctrine \Migrations \Tools \BytesFormatter ;
21
22
use Psr \Log \LoggerInterface ;
@@ -206,7 +207,7 @@ private function executeMigration(
206
207
207
208
if (count ($ this ->sql ) !== 0 ) {
208
209
if (! $ configuration ->isDryRun ()) {
209
- $ this ->executeResult ($ configuration );
210
+ $ this ->executeResult ($ configuration, $ plan );
210
211
} else {
211
212
foreach ($ this ->sql as $ idx => $ query ) {
212
213
$ this ->outputSqlQuery ($ idx , $ query );
@@ -324,9 +325,16 @@ private function logResult(Throwable $e, ExecutionResult $result, MigrationPlan
324
325
}
325
326
}
326
327
327
- private function executeResult (MigratorConfiguration $ configuration ) : void
328
+ private function executeResult (MigratorConfiguration $ configuration, MigrationPlan $ plan ) : void
328
329
{
329
330
foreach ($ this ->sql as $ key => $ query ) {
331
+ $ migrationQuery = new Query ($ query , $ this ->params [$ key ] ?? [], $ this ->types [$ key ] ?? []);
332
+ $ this ->dispatcher ->dispatchQueryExecuteEvent (
333
+ Events::onMigrationsQueryExecuting,
334
+ $ plan ,
335
+ $ configuration ,
336
+ $ migrationQuery
337
+ );
330
338
$ stopwatchEvent = $ this ->stopwatch ->start ('query ' );
331
339
332
340
$ this ->outputSqlQuery ($ key , $ query );
@@ -339,6 +347,13 @@ private function executeResult(MigratorConfiguration $configuration) : void
339
347
340
348
$ stopwatchEvent ->stop ();
341
349
350
+ $ this ->dispatcher ->dispatchQueryExecuteEvent (
351
+ Events::onMigrationsQueryExecuted,
352
+ $ plan ,
353
+ $ configuration ,
354
+ $ migrationQuery
355
+ );
356
+
342
357
if (! $ configuration ->getTimeAllQueries ()) {
343
358
continue ;
344
359
}
0 commit comments