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

Seeds with namespaces need to be specified by their fully qualified class name #2201

Open
LeonBlejcHttpool opened this issue Jun 9, 2023 · 0 comments

Comments

@LeonBlejcHttpool
Copy link

Currently, when using the -s option when running seeds with namespaces, the seeds need to be referred to by their fully qualified class name, and cannot be run with only their base class name.

My paths configuration is as follows

{
    "paths": {
        "migrations": {
            "Something\\Database\\Migrations\\Global": "%%PHINX_CONFIG_DIR%%/src/Migrations/Global"
        },
        "seeds": {
            "Something\\Database\\Seeds\\Global": "%%PHINX_CONFIG_DIR%%/src/Seeds/Global",
            "Something\\Database\\Seeds\\Global\\Dev": "%%PHINX_CONFIG_DIR%%/src/Seeds/Global/Dev"
        }
    }
}

A seed class called "ExampleSeeder" located in "%%PHINX_CONFIG_DIR%%/src/Seeds/Global" with a namespace of "Something\Database\Seeds\Global" still needs to be run with its fully qualified class name when run with the following command ./bin/phinx seed:run -s "Something\\\Database\\\Seeds\\\Global\\\ExampleSeeder". The command ./bin/phinx seed:run -s "ExampleSeeder" will report an error that the seed class does not exist.

Going over the code, this seems to be intentional and not a bug. Is there some other configuration setting that I'm missing which would enable the seed:run method to run with merely the class name? This would make running them by hand much less laboursome, especially when using multiple namespaces and multiple seed folders.

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