From 93c1a9d9331aa4ca14c880a9eeb6bd09d8364ca5 Mon Sep 17 00:00:00 2001 From: ryuring Date: Mon, 25 Nov 2024 18:52:55 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88=E3=81=AE?= =?UTF-8?q?=E3=82=AA=E3=83=B3=E3=82=AA=E3=83=95=E3=82=92=E8=A1=8C=E3=81=86?= =?UTF-8?q?=E9=9A=9B=E3=81=AB=E3=82=B0=E3=83=AD=E3=83=BC=E3=83=90=E3=83=AB?= =?UTF-8?q?=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88=E3=83=9E=E3=83=8D=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=A3=E3=83=BC=E3=82=92=E6=8C=87=E5=AE=9A=E3=81=97?= =?UTF-8?q?=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=AB=E4=BE=8B=E5=A4=96=E3=82=92?= =?UTF-8?q?=E6=8A=95=E3=81=92=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 処理がループしてしまうため --- plugins/baser-core/src/Utility/BcUtil.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/baser-core/src/Utility/BcUtil.php b/plugins/baser-core/src/Utility/BcUtil.php index c48cb7623c..8da2c6a2ae 100644 --- a/plugins/baser-core/src/Utility/BcUtil.php +++ b/plugins/baser-core/src/Utility/BcUtil.php @@ -11,6 +11,7 @@ namespace BaserCore\Utility; +use BaserCore\Error\BcException; use BaserCore\Middleware\BcAdminMiddleware; use BaserCore\Middleware\BcFrontMiddleware; use BaserCore\Middleware\BcRequestFilterMiddleware; @@ -1641,6 +1642,13 @@ public static function fgetcsvReg(&$handle, $length = null, $d = ',', $e = '"') */ public static function offEvent(EventManagerInterface $eventManager, string $eventKey) { + $reflection = new ReflectionClass($eventManager); + $property = $reflection->getProperty('_isGlobal'); + $property->setAccessible(true); + if($property->getValue($eventManager)) { + throw new BcException(__d('baser_core', 'グローバルイベントマネージャーからはイベントをオフにすることはできません。')); + } + $globalEventManager = $eventManager->instance(); $eventListeners = [ 'local' => $eventManager->prioritisedListeners($eventKey), @@ -1674,6 +1682,13 @@ public static function offEvent(EventManagerInterface $eventManager, string $eve */ public static function onEvent(EventManagerInterface $eventManager, string $eventKey, array $eventListeners) { + $reflection = new ReflectionClass($eventManager); + $property = $reflection->getProperty('_isGlobal'); + $property->setAccessible(true); + if($property->getValue($eventManager)) { + throw new BcException(__d('baser_core', 'グローバルイベントマネージャーからはイベントをオンにすることはできません。')); + } + $globalEventManager = $eventManager->instance(); if (!empty($eventListeners['local'])) { foreach($eventListeners['local'] as $priority => $listeners) {