Skip to content

Commit 135f2e3

Browse files
committed
cache strategy name is optional
1 parent 7d894fc commit 135f2e3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Commands/MakeAll.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ public function handle()
4242
'TemporaryCacheStrategy'
4343
];
4444

45-
if (in_array($this->option('strategy_name'), $strategyNames) === false) {
45+
$strategy = $this->option('strategy_name');
46+
47+
if ($strategy !== null && in_array($strategy, $strategyNames) === false) {
4648
$this->alert('This pattern strategy does not exist !!! ');
4749
exit;
4850
}
@@ -53,7 +55,6 @@ public function handle()
5355
$delete = $this->option('delete');
5456
$detectForeignKeys = $this->option('foreign-keys');
5557
$addToGit = $this->option('add-to-git');
56-
$strategy = $this->option('strategy_name');
5758

5859
if ($this->option('all-tables')) {
5960
$tableNames = $this->getAllTableNames()->pluck('TABLE_NAME');
@@ -93,10 +94,13 @@ private function runCommandsWithArguments(array $arguments, bool|array|string|nu
9394
'repository:make-resource' => $arguments,
9495
'repository:make-interface-repository' => $arguments,
9596
'repository:make-mysql-repository' => $arguments,
96-
'repository:make-redis-repository' => $arguments + ['strategy' => $strategy],
9797
'repository:make-repository' => $arguments + ['strategy' => $strategy, 'selected_db' => $selectedDb]
9898
];
9999

100+
if ($strategy !== null) {
101+
$commands['repository:make-redis-repository'] = $arguments + ['strategy' => $strategy];
102+
}
103+
100104
foreach ($commands as $command => $args) {
101105
$this->call($command, $args);
102106
}

0 commit comments

Comments
 (0)