Mercurial > packages > magicforger
diff src/Generator/BaseGenerator.php @ 26:555bfaa500ac codex
Big update for view creation based on the column type.
| author | Luka Sitas <sitas.luka.97@gmail.com> |
|---|---|
| date | Thu, 15 May 2025 21:50:38 -0400 |
| parents | 827efbf4d73c |
| children |
line wrap: on
line diff
--- a/src/Generator/BaseGenerator.php Sun May 11 21:03:51 2025 -0400 +++ b/src/Generator/BaseGenerator.php Thu May 15 21:50:38 2025 -0400 @@ -21,6 +21,8 @@ protected $currentTable = null; + protected static $cached_snippets = []; + public function handle() { @@ -187,4 +189,15 @@ { exec('./vendor/bin/pint '.escapeshellarg($path)); } + + protected function getSnippet($snippet_name) + { + // Cache snippet contents to avoid re-reading files + if (! isset(self::$cached_snippets[$snippet_name])) { + self::$cached_snippets[$snippet_name] = $this->files->get( + $this->resolveStubPath("/snippets/$snippet_name.stub")); + } + + return self::$cached_snippets[$snippet_name]; + } }
