我正在尝试使DoctrineExtensions与XML结合使用来为我的Doctrine 2工作。
看起来我很接近,但每次我尝试加载实体时,我的网站都会死并出现致命错误:
Class must be annoted with Loggable annotation in order to track versioned fields
in class
我的 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">
<entity name="BaseActivityOrganisation" table="activity_organisation">
<id name="id" type="integer" column="id">
<generator strategy="IDENTITY"/>
</id>
<field name="name" type="string" column="name" length="255" precision="0" scale="0">
<gedmo:versioned/>
</field>
</entity>
</doctrine-mapping>`
现在的问题:如何使用可移动的注释来注释我的类。
我忘记了xml的一部分。我不得不添加以下内容:
<gedmo:loggable log-entry-class="LogLocation"/>
其中,日志条目类是要用于日志记录的类。现在完成 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">
<entity name="BaseActivityOrganisation" table="activity_organisation">
<gedmo:loggable log-entry-class="LogLocation"/>
<id name="id" type="integer" column="id">
<generator strategy="IDENTITY"/>
</id>
<field name="name" type="string" column="name" length="255" precision="0" scale="0">
<gedmo:versioned/>
</field>
</entity>
</doctrine-mapping>