Skip to content

Commit

Permalink
bug #37056 [DoctrineBridge] register event listeners depending on the…
Browse files Browse the repository at this point in the history
… installed packages (xabbuh)

This PR was merged into the 5.1 branch.

Discussion
----------

[DoctrineBridge] register event listeners depending on the installed packages

| Q             | A
| ------------- | ---
| Branch?       | 5.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #37045
| License       | MIT
| Doc PR        |

Commits
-------

f61b009 register event listeners depending on the installed packages
  • Loading branch information
fabpot committed Jun 2, 2020
2 parents ab3772a + f61b009 commit 706ff58
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Expand Up @@ -89,9 +89,16 @@ public function onSchemaCreateTable(SchemaCreateTableEventArgs $event): void

public function getSubscribedEvents(): array
{
return [
ToolEvents::postGenerateSchema,
Events::onSchemaCreateTable,
];
$subscribedEvents = [];

if (class_exists(ToolEvents::class)) {
$subscribedEvents[] = ToolEvents::postGenerateSchema;
}

if (class_exists(Events::class)) {
$subscribedEvents[] = Events::onSchemaCreateTable;
}

return $subscribedEvents;
}
}
Expand Up @@ -43,6 +43,10 @@ public function postGenerateSchema(GenerateSchemaEventArgs $event): void

public function getSubscribedEvents(): array
{
if (!class_exists(ToolEvents::class)) {
return [];
}

return [
ToolEvents::postGenerateSchema,
];
Expand Down

0 comments on commit 706ff58

Please sign in to comment.