comparison 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
comparison
equal deleted inserted replaced
25:1a717c7b211f 26:555bfaa500ac
18 protected $schema = null; 18 protected $schema = null;
19 19
20 protected $tables = null; 20 protected $tables = null;
21 21
22 protected $currentTable = null; 22 protected $currentTable = null;
23
24 protected static $cached_snippets = [];
23 25
24 public function handle() 26 public function handle()
25 { 27 {
26 28
27 if (! $this->tableExists($this->getTableInput())) { 29 if (! $this->tableExists($this->getTableInput())) {
185 187
186 protected function format_file(string $path): void 188 protected function format_file(string $path): void
187 { 189 {
188 exec('./vendor/bin/pint '.escapeshellarg($path)); 190 exec('./vendor/bin/pint '.escapeshellarg($path));
189 } 191 }
192
193 protected function getSnippet($snippet_name)
194 {
195 // Cache snippet contents to avoid re-reading files
196 if (! isset(self::$cached_snippets[$snippet_name])) {
197 self::$cached_snippets[$snippet_name] = $this->files->get(
198 $this->resolveStubPath("/snippets/$snippet_name.stub"));
199 }
200
201 return self::$cached_snippets[$snippet_name];
202 }
190 } 203 }