-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
206 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace oat\taoEventLog\migrations; | ||
|
||
use common_ext_ExtensionsManager; | ||
use Doctrine\DBAL\Schema\Schema; | ||
use oat\oatbox\event\EventManager; | ||
use oat\tao\scripts\tools\migrations\AbstractMigration; | ||
use oat\taoEventLog\model\eventLog\LoggerService; | ||
|
||
final class Version202310191436392752_taoEventLog extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Attach DacChangedEvent to LoggerService'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
if ($this->getExtensionsManager()->isEnabled('taoDacSimple')) { | ||
$this->getEventManager()->attach( | ||
'oat\taoDacSimple\model\event\DacChangedEvent', | ||
[LoggerService::class, 'log'] | ||
); | ||
} | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->getEventManager()->detach( | ||
'oat\taoDacSimple\model\event\DacChangedEvent', | ||
[LoggerService::class, 'log'] | ||
); | ||
} | ||
|
||
private function getExtensionsManager(): common_ext_ExtensionsManager | ||
{ | ||
return $this->getServiceLocator()->get(common_ext_ExtensionsManager::SERVICE_ID); | ||
} | ||
|
||
private function getEventManager(): EventManager | ||
{ | ||
return $this->getServiceLocator()->get(EventManager::SERVICE_ID); | ||
} | ||
} |
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters