Bug: module:seed is not working with --class options provided
mufeedbinismail opened this issue · 0 comments
mufeedbinismail commented
When using the module:seed command with the --class options provided it is not honoring the --class option. Instead it is checking for the existance of the default path {ModuleName}DatabaseSeeder and the non existing class entierly stops the seeding process.
/** taken from src/Console/Commands/ModuleSeedCommand.php 97:104 **/
$fullPath = $namespacePath.'\\'.$module['basename'].'\Database\Seeds\\'.$rootSeeder;
/**
* In My Case
* App\Modules\{ModuleName}\Database\Seeds\{ModuleName}DatabaseSeeder
*/
if (class_exists($fullPath)) {
if ($this->option('class')) {
$params['--class'] = $this->option('class');
} else {
$params['--class'] = $fullPath;
}
.
.
.
This may help a little bit to understand what I am saying
$defaultClassPath = $namespacePath.'\\'.$module['basename'].'\Database\Seeds\\'.$rootSeeder;
$optionalClassPath = $this->option('class');
$fullPath = $optionalClassPath ? $optionalClassPath : $defaultClassPath;
if(class_exists($fullpath)){
$params['--class'] = $fullPath;
.
.
.
PS: I renamed the class as a dirty fix.