我正在尝试根据schema.xml文件使用命令
来创建使用Propel ORM创建SQL架构.vendorbinpropel sql:build
我遇到了一个错误,就是这样:
[SymfonyComponentConfigDefinitionExceptionInvalidTypeException]
Invalid type for path "propel.database.connections.project.attributes". Expected array, but got string
这是我的propel.xml文件:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<config>
<propel>
<database>
<connections>
<connection id="project">
<adapter>mysql</adapter>
<classname>PropelRuntimeConnectionConnectionWrapper</classname>
<dsn>mysql:host=localhost;dbname=project</dsn>
<user>root</user>
<password></password>
<attributes></attributes>
</connection>
</connections>
</database>
<runtime>
<defaultConnection>project</defaultConnection>
<connection>project</connection>
</runtime>
<generator>
<defaultConnection>project</defaultConnection>
<connection>project</connection>
</generator>
</propel>
</config>
这是我的schema.xml文件:
<database name="project" defaultIdMethod="native">
<table name="user" phpName="User">
<column name="id" type="integer" size="255" required="true" primarykey="true" autoincrement="true"></column>
<column name="username" type="varchar" size="255" required="true"></column>
<column name="password" type="varchar" size="255" required="true"></column>
<column name="email" type="varchar" size="255" required="true"></column>
</table>
</database>
通过在propel.xml中评论 <attributes></attributes>
标签来修复它:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<config>
<propel>
<database>
<connections>
<connection id="project">
<adapter>mysql</adapter>
<classname>PropelRuntimeConnectionConnectionWrapper</classname>
<dsn>mysql:host=localhost;dbname=project</dsn>
<user>root</user>
<password></password>
<!--
<attributes></attributes>
-->
</connection>
</connections>
</database>
<runtime>
<defaultConnection>project</defaultConnection>
<connection>project</connection>
</runtime>
<generator>
<defaultConnection>project</defaultConnection>
<connection>project</connection>
</generator>
</propel>
</config>