我有一堆 Phinx 种子,以前运行得很好
php vendor/bin/phinx seed:run
我的种子位于
var/www/html/db/seeds
文件夹
我最近将我的虚拟机升级到 php 7.0(还升级到 16.04 LTS 盒),现在当我尝试运行 phinx seeds 时,我收到以下输出和错误:
ubuntu@ubuntu-xenial:/var/www/html$ sudo vendor/bin/phinx seed:run
Phinx by Rob Morgan - https://phinx.org. version 0.5.4
using config file ./phinx.yml
using config parser yaml
using migration path /var/www/html/db/migrations
using seed path /var/www/html/db/seeds
warning no environment specified, defaulting to: development
using adapter mysql
using database closecall
[InvalidArgumentException]
The seed class "" does not exist
重申一下,种子运行良好,升级到 php 7.0,但现在不行了。
但是,迁移仍然运行得很好。
我已经删除了除一之外的所有种子:
<?php
use Phinx\Seed\AbstractSeed;
class CategorySeeder extends AbstractSeed
{
public function run()
{
$data = array(
array(
'name' => 'Confined Spaces'
)
);
}
}
调试,仍然给出同样的错误。
尝试:
php vendor/bin/phinx seed:run -s CategorySeeder
添加
void
作为返回类型,它应该按 PHP 7+ 的预期工作。
<?php
use Phinx\Seed\AbstractSeed;
class CategorySeeder extends AbstractSeed
{
/**
* @return void
*/
public function run(): void
{
$data = array(
array(
'name' => 'Confined Spaces'
)
);
}
}