我正在一个项目中,实体映射是通过XML进行的。这就是我的实体的样子:
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-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="Device\DeviceBundle\Entity\Device" table="device">
<id name="id" type="integer" column="id">
<generator strategy="AUTO" />
</id>
<field name="description" column="description" type="string" length="255" unique="true" nullable="false" />
<field name="imei" column="imei" type="string" length="17" unique="true" nullable="false" />
<field name="created" type="datetime">
<gedmo:timestampable on="create"/>
</field>
<field name="modified" type="datetime">
<gedmo:timestampable on="update"/>
</field>
<field name="deletedAt" type="datetime" nullable="true" />
<gedmo:soft-deleteable field-name="deletedAt" time-aware="false" />
</entity>
</doctrine-mapping>
当我doctrine:schema:validate
从Symfony2控制台运行命令时,将其作为输出:
[Doctrine \ Common \ Persistence \ Mapping \ MappingException]
类“ TaxiBooking \ Device \ DeviceBundle \ Entity \ Device”不存在
是的,没错,该文件不存在,但是我应该创建该文件还是错过XML映射中的某些内容?有什么帮助吗?
好吧,我会回答自己的,因为没人会回答。答案是“是”,因为描述字段,列,关系定义等的XML映射与注释映射完全相同,所以需要创建文件。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句