2014-12-02 79 views
0

我选择了对配置的XML文件,但我得到以下错误,当我运行./vendor/bin/propel sql:buildPropel.xml给我一个错误 - 路径“propel.database.connections.cfs.attributes”的类型无效。预计阵,但得到的字符串

[Symfony\Component\Config\Definition\Exception\InvalidTypeException] 
Invalid type for path "propel.database.connections.cfs.attributes". Expected array, but got string 

这里是我的propel.xml文件

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> 
<config> 
    <propel> 
     <database> 
      <connections> 
       <connection id="cfs"> 
        <adapter>mysql</adapter> 
        <classname>Propel\Runtime\Connection\ConnectionWrapper</classname> 
        <dsn>mysql:host=localhost;dbname=cfs_development</dsn> 
        <user>cfs_user</user> 
        <password>cfs_pass</password> 
        <attributes></attributes> 
       </connection> 
      </connections> 
     </database> 
     <runtime> 
      <defaultConnection>cfs</defaultConnection> 
      <connection>cfs</connection> 
     </runtime> 
     <generator> 
      <defaultConnection>cfs</defaultConnection> 
      <connection>cfs</connection> 
     </generator> 
    </propel> 
</config> 

..和我的schema.xml文件

<?xml version="1.0" encoding="UTF-8"?> 
<database name="cfs" defaultIdMethod="native"> 
    <table name="projects" phpName="Project" namespace="Cfs\Model"> 
     <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true"/> 
     <column name="title" type="varchar" size="255" required="true" /> 
     <column name="user_id" type="integer" required="true"/> 
     <foreign-key foreignTable="users" phpName="User"> 
      <reference local="user_id" foreign="id"/> 
     </foreign-key> 
    </table> 
    <table name="users" phpName="User" namespace="Cfs\Model"> 
     <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true"/> 
     <column name="username" type="varchar" size="255" required="true" /> 
     <column name="password" type="varchar" size="255" required="true" /> 
     <column name="salt" type="varchar" size="255" required="true" /> 
    </table> 
</database> 

我从官方文档中获取propel.xml配置文件的详细信息,然后它说只是运行t他指挥。但是,我得到这个错误?有什么建议么?

然后,我只是试图使用PHP文件进行数据库配置(propel.php),这次命令运行没有错误。但是,我的数据库没有创建。我试图运行vendor/bin/propel模型:构建它以查看它是否生成了我的类,这也可以毫无错误地运行,但我无法看到它生成我的类的位置。

这两个配置文件都在我的应用程序的根目录,这也是我运行每个命令的地方。

回答

0

好像有在XML配置文件创建有趣issues--

我试过XML转换为阳明海运与已经给了我一个不同的错误,我可以追跌在线converter--。使用propel.yml文件

[Symfony\Component\Config\Definition\Exception\InvalidTypeException]           
Invalid type for path "propel.database.connections.unrestricted.attributes". Expected array, but got string 

错误:

[Symfony\Component\Yaml\Exception\ParseException] 
Unable to parse at line 8 (near " settings: "). 

我要重读此页:

http://propelorm.org/documentation/reference/configuration-file.html

使用propel.xml文件

错误

并进行任何编辑,我觉得会有所帮助。当它工作时我会更新。

嗯,它工作的很好。

我用他们的模板,并使用.yml格式替换我的数据库信息。为了安全起见,我还将我的multibyte4utf8字符集更改为标准的UTF-8。

0

您应该在您的​​3210中评论属性标记。

另外,您的dbnamedsn-config.xml应与schema.xml中的数据库标记的名称相同。

解决这个问题,然后再试一次,那会很好。

相关问题