Php libxml2无法加载条令实体元数据
我对教义提出了一个非常奇怪的问题。它无法加载特定实体的元数据。我的所有其他实体都可以正常加载,但当我尝试加载以下XML时失败:Php libxml2无法加载条令实体元数据,php,symfony,doctrine-orm,doctrine,libxml2,Php,Symfony,Doctrine Orm,Doctrine,Libxml2,我对教义提出了一个非常奇怪的问题。它无法加载特定实体的元数据。我的所有其他实体都可以正常加载,但当我尝试加载以下XML时失败: <?xml version="1.0" encoding="UTF-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" x
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Foo\ContentBundle\Entity\Item" table="content_item">
<id name="id" column="id" type="integer">
<generator strategy="AUTO" />
</id>
<field name="gid" column="gid" type="string" nullable="false" unique="false" />
<field name="url" column="url" type="string" nullable="true" unique="false" />
<field name="title" column="title" type="string" nullable="false" unique="false" />
<field name="content" column="content" type="text" nullable="false" unique="false" />
<field name="timestamp" column="timestamp" type="datetime" nullable="false" unique="false" />
<many-to-one field="feed" target-entity="Foo\ContentBundle\Entity\Feed">
<join-column name="feed" referenced-column-name="id" nullable="false" on-delete="CASCADE" />
</many-to-one>
</entity>
它引发以下异常:
类“Foo\ContentBundle\Entity\Item”的映射文件“Foo.ContentBundle.Entity.Item.orm.xml”无效。
libxml2给出了以下错误:
加载外部实体失败“/Users/ramon/Development/foo/src/foo/ContentBundle/Resources/config/doctor/Item.orm.xml”
奇怪的是,我所有的其他实体都很好!有人知道如何解决这个问题吗
我使用的是libxml版本2.9.0、ORM版本2.4.7和Symfony版本2.6以及PHP5.6.5
[编辑]忘记了最好的部分:只有在加载元数据以从存储库中获取实体时才会发生这种情况。当我将一个实体插入到存储库中时就不是了
另外,当我尝试使用
simplexml\u load\u file
手动加载文件时,它工作正常。我已经找到了原因
我正在使用另一个库(),它调用libxml\u disable\u entity\u loader(true)
函数,这反过来会导致一个错误。我现在已经创建了一个for picoFeed,它在安全检查完成后启用实体加载器。这解决了上述问题