Mercurial > packages > magicforger
diff src/Generator/Model/ModelGenerator.php @ 28:f88d2d5dee30 codex
Updated inputs and routes
| author | Luka Sitas <sitas.luka.97@gmail.com> |
|---|---|
| date | Mon, 09 Jun 2025 19:51:31 -0400 |
| parents | 555bfaa500ac |
| children | 010ace248d14 |
line wrap: on
line diff
--- a/src/Generator/Model/ModelGenerator.php Mon Jun 02 21:51:09 2025 -0400 +++ b/src/Generator/Model/ModelGenerator.php Mon Jun 09 19:51:31 2025 -0400 @@ -93,6 +93,17 @@ } + protected function renderFilters() { + $insert = ''; + foreach ($this->get_columns() as $column) { + if (in_array($column['name'], $this->columns_to_ignore)) { + continue; + } + $insert .= sprintf("'%s',", $column['name'])."\n"; + } + + } + protected function renderRelations($relations) { $renders = [ 'belongsTo' => [], @@ -175,6 +186,7 @@ return $string; } + /** * Get available insertions including model relationships. * @@ -186,8 +198,9 @@ $inserts = parent::get_available_inserts(); // Gather and render relationships for this model - $relations = RelationshipNavigator::getRelations($this->getCurrentTable()); + $relations = $this->gatherRelations(); $rendered = $this->renderRelations($relations); + $filters = $this->renderFilters(); // Build code blocks for each relation type $belongs = !empty($rendered['belongsTo']) ? implode("\n ", $rendered['belongsTo']) : ''; @@ -202,6 +215,7 @@ $inserts['# {{ has_many_relationships }}'] = $hasMany; $inserts['# {{ has_many_through_relationships }}'] = $belongsMany; $inserts['# {{ defaultRelationsInsertPoint }}'] = $default_relations; + $inserts['# {{ defaultFiltersInsertPoint }}'] = $filters; return $inserts; }
