From: DmitryPuchkov Date: Wed, 3 Sep 2008 16:20:42 +0000 (+0300) Subject: intercept directory not found exception from loadModels X-Git-Tag: 0.5~512 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=faf87c599c775b72a82ad29e4926f04d2e63c4e3;p=ipf.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];