Migration Action throws error when there are non Action files within the actions folder
milewski opened this issue · 4 comments
Environment
- PHP Version: 8.1
- Database Driver & Version: MySQL
- Migration Actions Version: 3.x
- Laravel Version: 9.x
Issue description
I have a subfolder within my actions folder that does not contain Action classes.. example:
By Running php artisan migrate:actions I get the following error:
DragonCode\LaravelActions\Services\Migrator::resolveAction(): Return value must be of type DragonCode\LaravelActions\Action, int returnedI think files that do not extend Action shouldn't be taken into account or files that don't start with xxxx_xx_xx_xxxxx_..... etc...
Steps to reproduce
Create any file within a subfolder inside the actions directory and run php artisan migrate:actions
Yes, in the 3rd version all subfolders are now read.
You gave me an idea: today I will make it possible to set exceptions for folders when searching for files in the settings.
Wouldn't it be easier to have a regular expression excluding any file that doesn't match the pattern? xxxx_xx_xx_xxxxx?
I imagine somewhere you may have a collection of files.. then would be just a matter of $files->filter(regex)
I thought about it, but, unfortunately, not all developers prefer this file format. I have seen projects where files were created manually without a time prefix.
Making an exception for a folder is easy, I will write tests longer :-)
As soon as I get to the computer, I'll do it.
Released in v3.1.0.
Run the composer update console command and update your config file.
