Same problem. Installed Laravel this week.
Workflow:
dave@dave-VirtualBox ~/laravel $ php artisan migrate:make one
Created Migration: 2014_03_16_042521_one
Generating optimized class loader
dave@dave-VirtualBox ~/laravel $ php artisan migrate
Migrated: 2014_03_16_042521_one
dave@dave-VirtualBox ~/laravel $ php artisan migrate:rollback
PHP Fatal error: Class 'One' not found in /home/dave/Documents/bitbucket/laravel-learn/laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php on line 297
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'One' not found","file":"\/home\/dave\/Documents\/bitbucket\/laravel-learn\/laravel\/vendor\/laravel\/framework\/src\/Illuminate\/Database\/Migrations\/Migrator.php","line":297}}{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'One' not found","file":"\/home\/dave\/Documents\/bitbucket\/laravel-learn\/laravel\/vendor\/laravel\/framework\/src\/Illuminate\/Database\/Migrations\/Migrator.php","line":297}}
Run composer dumpautoload
before migrate:rollback
and see if that'll fix it.
php composer.phar dump-autoload indeed fixes this. But still I think it's a bug that 'migrate' does not depend on the autoload feature and apparently migrate:rollback does. Very fonfusing to new users, at least to me.
In Migrator::run(), the requireFiles() method is called (to include the migration files) before running the migrations. In Migrator::rollback(), requireFiles() is not called and loading the classes is dependent on the autoload feature. This should at least be more consistent.
Agree that this is also confusing because of the consistency. I never looked into the details so great to get an insight into what's happening.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community