From 53873600c1b517628ed3a108c2d9316cf3be89b2 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 9 Oct 2015 13:34:24 +1100 Subject: [PATCH] Enabled having a default Model instead of needing Model_* files for each table. --- system/classes/Kohana/Core.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/system/classes/Kohana/Core.php b/system/classes/Kohana/Core.php index 860090d..faf55f3 100644 --- a/system/classes/Kohana/Core.php +++ b/system/classes/Kohana/Core.php @@ -514,6 +514,17 @@ class Kohana_Core { return TRUE; } + // Enable finding a default Model + if (preg_match('/^Model_/',$class) AND $path = Kohana::find_file($directory,'Model/DEFAULT')) { + // Load the class file + require $path; + + Model_DEFAULT::_default($class); + + // Class has been found + return TRUE; + } + // Class is not in the filesystem return FALSE; }