From: DmitryPuchkov Date: Wed, 3 Sep 2008 16:20:42 +0000 (+0300) Subject: intercept directory not found exception from loadModels X-Git-Tag: 0.6~179 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=eeb67d27211b42aa0fd36e7dbca31e711bff2a8b;p=ipf-legacy-orm.git intercept directory not found exception from loadModels --- diff --git a/ipf/orm.php b/ipf/orm.php index 7a11103..f728ac5 100644 --- a/ipf/orm.php +++ b/ipf/orm.php @@ -243,8 +243,12 @@ final class IPF_ORM { public static function loadModels($directory, $modelLoading = null) { $loadedModels = array(); - $it = new DirectoryIterator($directory.DIRECTORY_SEPARATOR.'_generated'); - foreach ($it as $file) { + try{ + $it = new DirectoryIterator($directory.DIRECTORY_SEPARATOR.'_generated'); + }catch(RuntimeException $e){ + return $loadedModels; + } + foreach ($it as $file) { $e = explode('.', $file->getFileName()); if (end($e) === 'php') { $className = $e[0];