我第一次尝试在我正在开发的 Propel 项目中使用迁移(因此我不必重新插入 15MB 的数据),但遇到了一些困难。我在架构中进行了更改并运行了propel-gen diff
. 我首先收到一个错误,它无法找到我的buildtime-conf.xml
文件。我还没有做一个(因为没有必要),但读到结构应该与runtime-conf.xml
. 我复制runtime-conf.xml
到buildtime-conf.xml
. 现在收到以下错误:
[propel-sql-diff] Reading databases structure...
[phingcall] Unable to find adapter for datasource [project].
Execution of target "sql-diff" failed for the following reason: /var/www/project/vendor/propel/propel1/generator/build-propel.xml:317:26: Execution of the target buildfile failed. Aborting.
[phing] /var/www/project/vendor/propel/propel1/generator/build-propel.xml:317:26: Execution of the target buildfile failed. Aborting.
我的运行时和构建时文件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<propel>
<datasources default="project">
<datasource id="project">
<adapter>pgsql</adapter>
<connection>
<dsn>pgsql:host=###.###.###.###;dbname=database</dsn>
<user>USER</user>
<password>PASS</password>
</connection>
</datasource>
</datasources>
</propel>
</config>
我的模式是这样的:
<?xml version="1.0" encoding="UTF-8"?>
<database name="project" defaultIdMethod="native">
<table schema="accounts" name="accounts" phpName="Account" package="accounts">
<column />
</table>
</database>
我尝试将 buildtime-conf 更改为<datasource id="testing">
并将错误更改为Unable to find adapter for datasource [testing]
. 因此,据我所知,错误在于实际的 buildtime-conf 文件(而不是模式)。我想也许 Propel 找不到 PostgreSQL 的适配器(即使它在我的 runtime-conf 中运行良好),所以我尝试将我的适配器更改为mysql
. 它提出了同样的无法找到适配器错误。
我完全迷路了,想法?
更新:所以我能够进入/Propel/runtime/lib/Propel.php
并找到Unable to find adapter
引发异常的行。我通过添加该行手动定义了变量self::$configuration['datasources'][$name]['adapter'] = 'pgsql'
,它可以工作。这显然目前没有验证有用,因为如果不重做此更改,我将无法更新 Propel。我倾倒self::$configuration
在 Propel.php 中,它是NULL
,任何想法为什么?