Php Phinx迁移错误,“找不到类”,但正在查找正确的文件?
我正在尝试使用phinx库为一个名为“Vokuro”的Phalcon框架示例项目运行数据库迁移,我遇到了这个错误。文件目录是正确的,所以我不知道为什么会发生这种情况 命令: C:\xampp\htdocs\vokuro\db\migrations\20190825181051\u create\u email\u confirmations.php: C:\xampp\htdocs\vokuro\vendor\robmorgan\phinx\src\phinx\Migration\Manager.php:Php Phinx迁移错误,“找不到类”,但正在查找正确的文件?,php,phalcon,phinx,Php,Phalcon,Phinx,我正在尝试使用phinx库为一个名为“Vokuro”的Phalcon框架示例项目运行数据库迁移,我遇到了这个错误。文件目录是正确的,所以我不知道为什么会发生这种情况 命令: C:\xampp\htdocs\vokuro\db\migrations\20190825181051\u create\u email\u confirmations.php: C:\xampp\htdocs\vokuro\vendor\robmorgan\phinx\src\phinx\Migration\Manager
因为您正在使用自己的配置文件:
using config file .\phinx.json
而不是phinx.php。此文件位于项目的根目录下。
此文件中有paths key,它为迁移和种子指定名称空间。因为您正在使用自己的配置文件:
using config file .\phinx.json
而不是phinx.php。此文件位于项目的根目录下。
此文件中有paths key,它指定迁移和种子的名称空间。使用该文件会引发以下错误:致命错误:未捕获错误:在C:\xampp\htdocs\vokuro\phinx.php中找不到类“Dotenv\Dotenv”:5堆栈跟踪:0{main}在第5行的C:\xampp\htdocs\vokuro\phinx.php中抛出为什么?您需要通过运行composer安装来安装composer依赖项。使用该文件会抛出以下错误:致命错误:未捕获错误:在C:\xampp\htdocs\vokuro\phinx.php中找不到类“Dotenv\Dotenv”:5堆栈跟踪:0{main}在第5行的C:\xampp\htdocs\vokuro\phinx.php中抛出了为什么?您需要通过运行composer安装来安装composer依赖项。
// convert the filename to a class name
$class = ($namespace === null ? '' : $namespace . '\\') . Util::mapFileNameToClassName(basename($filePath));
if (isset($fileNames[$class])) {
throw new InvalidArgumentException(sprintf(
'Migration "%s" has the same name as "%s"',
basename($filePath),
$fileNames[$class]
));
}
$fileNames[$class] = basename($filePath);
if ($this->getOutput()->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG) {
$this->getOutput()->writeln("Loading class <info>$class</info> from <info>$filePath</info>.");
}
// load the migration file
$orig_display_errors_setting = ini_get('display_errors');
ini_set('display_errors', 'On');
/** @noinspection PhpIncludeInspection */
require_once $filePath;
ini_set('display_errors', $orig_display_errors_setting);
if (!class_exists($class)) {
throw new InvalidArgumentException(sprintf(
'Could not find class "%s" in file "%s"',
$class,
$filePath
));
}
using config file .\phinx.json