Skip to content

Commit

Permalink
applied code review suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
sammyskills committed Oct 24, 2023
1 parent 10815db commit 23eb997
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions system/Commands/Generators/ModelGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ protected function prepare(string $class): string
$baseClass = $match[1];
}

// Add or remove the DBGroup line based on the presence of the dbgroup option
$addDBGroupLine = is_string($dbGroup);

$table = is_string($table) ? $table : plural(strtolower($baseClass));
$return = is_string($return) ? $return : 'array';

Expand Down Expand Up @@ -131,6 +128,6 @@ protected function prepare(string $class): string
$return = "'{$return}'";
}

return $this->parseTemplate($class, ['{dbGroup}', '{table}', '{return}'], [$dbGroup, $table, $return], compact('addDBGroupLine'));
return $this->parseTemplate($class, ['{dbGroup}', '{table}', '{return}'], [$dbGroup, $table, $return], compact('dbGroup'));
}
}
2 changes: 1 addition & 1 deletion system/Commands/Generators/Views/model.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class {class} extends Model
{
<?php if ($addDBGroupLine): ?>
<?php if (is_string($dbGroup)): ?>
protected $DBGroup = '{dbGroup}';
<?php endif; ?>
protected $table = '{table}';
Expand Down

0 comments on commit 23eb997

Please sign in to comment.