Skip to content

Commit 82c812d

Browse files
authored
Fix path generation for generate:repository command - Fix #712 (#713)
Basically, I reversed the `str_replace` statements which was wrong. Imagine this namespace: `App\Restify\User`. With the old code: ```php str_replace('App\\', 'app/', str_replace('\\', '/', $namespace)).'/'.$className.'.php'; ``` it would first execute the `str_replace('\\', '/', $namespace))` which results in this string: `App/Restify/User`, meaning the next code execution is useless: ```php str_replace('App\\', 'app/', 'App/Restify/User') ```
1 parent 72be19d commit 82c812d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Commands/GenerateRepositoriesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ protected function getRepositoryPath(array $modelData): string
562562
$namespace = $this->getRepositoryNamespace($modelData);
563563
$className = $modelData['name'].'Repository';
564564

565-
return str_replace('App\\', 'app/', str_replace('\\', '/', $namespace)).'/'.$className.'.php';
565+
return str_replace('\\', '/', str_replace('App\\', 'app/', $namespace)).'/'.$className.'.php';
566566
}
567567

568568
protected function getRepositoryFilePath(array $modelData): string

0 commit comments

Comments
 (0)