Skip to content

Commit 23eb997

Browse files
committed
applied code review suggestion
1 parent 10815db commit 23eb997

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

system/Commands/Generators/ModelGenerator.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ protected function prepare(string $class): string
101101
$baseClass = $match[1];
102102
}
103103

104-
// Add or remove the DBGroup line based on the presence of the dbgroup option
105-
$addDBGroupLine = is_string($dbGroup);
106-
107104
$table = is_string($table) ? $table : plural(strtolower($baseClass));
108105
$return = is_string($return) ? $return : 'array';
109106

@@ -131,6 +128,6 @@ protected function prepare(string $class): string
131128
$return = "'{$return}'";
132129
}
133130

134-
return $this->parseTemplate($class, ['{dbGroup}', '{table}', '{return}'], [$dbGroup, $table, $return], compact('addDBGroupLine'));
131+
return $this->parseTemplate($class, ['{dbGroup}', '{table}', '{return}'], [$dbGroup, $table, $return], compact('dbGroup'));
135132
}
136133
}

system/Commands/Generators/Views/model.tpl.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class {class} extends Model
88
{
9-
<?php if ($addDBGroupLine): ?>
9+
<?php if (is_string($dbGroup)): ?>
1010
protected $DBGroup = '{dbGroup}';
1111
<?php endif; ?>
1212
protected $table = '{table}';

0 commit comments

Comments
 (0)