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

Command Line Seeding Error #601

Closed
SmolSoftBoi opened this issue Jul 12, 2017 · 7 comments
Closed

Command Line Seeding Error #601

SmolSoftBoi opened this issue Jul 12, 2017 · 7 comments

Comments

@SmolSoftBoi
Copy link
Contributor

SmolSoftBoi commented Jul 12, 2017

The documentation says to run php index.php migrations seed TestSeeder to seed data from the command line, but running this command produces the error:

ERROR: Page Not Found

Controller or its method is not found.

Looks like it should be php ci.php db:seed TestSeeder?

@lonnieezell
Copy link
Member

Sorry - looks like that portion of the docs is incorrect. And at a glance I'm not seeing any docs about what it should be. Bad me.

try this:

php ci.php db:seed

@SmolSoftBoi
Copy link
Contributor Author

So the command works, but it can't find my seed TestSeeder producing the error:

CodeIgniter CLI Tool - Version 4.0-dev - Server-Time: 2017-07-13 09:36:33am


An uncaught Exception was encountered

Type:        Error
Message:     Class 'TestSeeder' not found
Filename:    /Users/kristian/Repos/cozyglow.co.uk/system/Database/Seeder.php
Line Number: 155

@lonnieezell
Copy link
Member

I believe it doesn't handle namespaced classes at the moment, so try removing any namespace from the seeds. I guess that needs fixing.

@lonnieezell
Copy link
Member

I was wrong, it should support namespaced files just fine.

Can you show me the basics of your TestSeeder class and where it's located?

@SmolSoftBoi
Copy link
Contributor Author

SmolSoftBoi commented Jul 14, 2017

applications/Database/Seeds/TestSeeder.php

namespace App\Database\Seeds;

use CodeIgniter\Database\Seeder;

class TestSeeder extends Seeder
{
    public function run()
    {
        $this->call(ProductCategorySeeder::class);
        $this->call(ProductSeeder::class);
    }
}

@lonnieezell
Copy link
Member

Remove the namespace from your Seeder and you should be good.

@SmolSoftBoi
Copy link
Contributor Author

@lonnieezell Thanks, I'll do that! But shouldn't it support namespaces as you mentioned?

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

No branches or pull requests

3 participants