diff options
Diffstat (limited to 'core/namespace/Application.php')
-rw-r--r-- | core/namespace/Application.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/namespace/Application.php b/core/namespace/Application.php index 3cecf3b..829f758 100644 --- a/core/namespace/Application.php +++ b/core/namespace/Application.php @@ -6,6 +6,7 @@ class Application { #=============================================================================== private static $Database; private static $Language; + private static $Migrator; private static $repositories = []; #=============================================================================== @@ -81,6 +82,19 @@ class Application { } #=============================================================================== + # Return singleton Migrator instance + #=============================================================================== + public static function getMigrator(): Migrator { + if(!self::$Migrator instanceof Migrator) { + $Migrator = new Migrator(self::getDatabase()); + $Migrator->setMigrationsDir(ROOT.'core/db/migrations/'); + self::$Migrator = $Migrator; + } + + return self::$Migrator; + } + + #=============================================================================== # Return singleton repository instance #=============================================================================== public static function getRepository(string $namespace): Repository { |