Skip to content

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

Description

@mufeedbinismail

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions