Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: module:seed is not working with --class options provided #419

Open
mufeedbinismail opened this issue Jun 11, 2020 · 0 comments
Open

Comments

@mufeedbinismail
Copy link

mufeedbinismail commented Jun 11, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant