条令2存储库映射错误XML
我犯了这个错误,我已经坚持了两天了,所以我希望一些善良的灵魂可能有线索 使用Zend 1和条令2,条令被配置为XML模式文件。 我使用条令控制台命令来生成实体、代理、历史记录和sql转储 生成所有内容都很好,我只需添加xml模式文件并开始生成。然而,当我运行应用程序时,会出现以下错误:条令2存储库映射错误XML,xml,zend-framework,doctrine,mapping,schema,Xml,Zend Framework,Doctrine,Mapping,Schema,我犯了这个错误,我已经坚持了两天了,所以我希望一些善良的灵魂可能有线索 使用Zend 1和条令2,条令被配置为XML模式文件。 我使用条令控制台命令来生成实体、代理、历史记录和sql转储 生成所有内容都很好,我只需添加xml模式文件并开始生成。然而,当我运行应用程序时,会出现以下错误: Message: No mapping file found named 'Application.Models.Repository.Users.xml' for class 'Application\Mode
Message: No mapping file found named 'Application.Models.Repository.Users.xml' for class 'Application\Models\Repository\Users'.
Message: Invalid mapping file 'Application.Models.Repository.Users.xml' for class 'Application\Models\Repository\Users'.
文件结构是
zend
'-application
'-Models
'-Entities
'-Proxies
'-Repository
'-Schemas
我使用的模式文件命名为Application.Models.Entities.Users.xml(我选择了xml,而不是dcm.xml)如下所示:
<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="Application\Models\Entities\Users" table="users"
repository-class="Application\Models\Repository\Users" >
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
<field name="username" column="username" type="string" length="50" nullable="false" unique="true" />
<field name="password" column="password" type="string" length="32" nullable="false" />
<field name="role" column="role" type="string" length="50" nullable="false" />
<field name="created" column="created" type="datetime" nullable="false" />
<field name="lastLogin" column="lastlogin" type="datetime" nullable="false" />
</entity>
</doctrine-mapping>
我在这里遗漏了什么?您提供的XML缺少一个结束标记:
。是的,不幸的是它就在这里。为了回答我自己的问题,我在$em->getRepository()中有错误的实体名称。现在它已修复,并按预期工作。