From cacb5ae2a0bc7f79e67aa9c80e12cec4bc92f0cb Mon Sep 17 00:00:00 2001 From: Emmanuel Dyan Date: Tue, 8 Dec 2015 15:00:03 +0100 Subject: [PATCH] Finder sent an exception when a folder doesn't exist --- src/LogicHook.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/LogicHook.php b/src/LogicHook.php index 2e5e1bd..ba8b32b 100644 --- a/src/LogicHook.php +++ b/src/LogicHook.php @@ -199,10 +199,12 @@ public function getHooksDefinitionsFromFiles($module, $byFiles = true) // find files in ExtDir $customExtDir = 'custom/Extension/modules/' . $beanManager->getModuleDirectory($module) . '/Ext/LogicHooks/'; - $finder = new Finder(); - $finder->files()->in($customExtDir)->name('*.php'); - foreach ($finder as $file) { - $files[] = $customExtDir . $file->getRelativePathname(); + if (is_dir($customExtDir)) { + $finder = new Finder(); + $finder->files()->in($customExtDir)->name('*.php'); + foreach ($finder as $file) { + $files[] = $customExtDir . $file->getRelativePathname(); + } } // read file and exit as soon as we find one