From 2c209665a70455dd221a1b7555e796cc55733de7 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Sun, 17 Jan 2021 18:09:01 +0900 Subject: [PATCH] use logicalOr --- src/QueryRepositoryAopModule.php | 40 ++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/QueryRepositoryAopModule.php b/src/QueryRepositoryAopModule.php index 23a9c315..a9e6eeed 100644 --- a/src/QueryRepositoryAopModule.php +++ b/src/QueryRepositoryAopModule.php @@ -17,29 +17,35 @@ class QueryRepositoryAopModule extends AbstractModule */ protected function configure() { - // @Cacheable $this->bindPriorityInterceptor( $this->matcher->annotatedWith(Cacheable::class), $this->matcher->startsWith('onGet'), [CacheInterceptor::class] ); - foreach (['onPost', 'onPut', 'onPatch', 'onDelete'] as $starts) { - $this->bindInterceptor( - $this->matcher->annotatedWith(Cacheable::class), - $this->matcher->startsWith($starts), - [CommandInterceptor::class] - ); - $this->bindInterceptor( - $this->matcher->logicalNot( - $this->matcher->annotatedWith(Cacheable::class) - ), + $this->bindInterceptor( + $this->matcher->annotatedWith(Cacheable::class), + $this->matcher->logicalOr( + $this->matcher->startsWith('onPost'), $this->matcher->logicalOr( - $this->matcher->annotatedWith(Purge::class), - $this->matcher->annotatedWith(Refresh::class) - ), - [RefreshInterceptor::class] - ); - } + $this->matcher->startsWith('onPut'), + $this->matcher->logicalOr( + $this->matcher->startsWith('onPatch'), + $this->matcher->startsWith('onDelete') + ) + ) + ), + [CommandInterceptor::class] + ); + $this->bindInterceptor( + $this->matcher->logicalNot( + $this->matcher->annotatedWith(Cacheable::class) + ), + $this->matcher->logicalOr( + $this->matcher->annotatedWith(Purge::class), + $this->matcher->annotatedWith(Refresh::class) + ), + [RefreshInterceptor::class] + ); $this->bindInterceptor( $this->matcher->annotatedWith(AbstractCacheControl::class),