Skip to content

Commit

Permalink
register event listeners depending on the installed packages
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jun 2, 2020
1 parent e5b5d9e commit 4e3c374
Showing 1 changed file with 11 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;
}
}

0 comments on commit 4e3c374

Please sign in to comment.