我正在努力使DoctrineExtensions与我的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="Base\Activity\Organisation" 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>`
现在的问题是:如何使用Loggable注释来注释我的类。
答案 0 :(得分:1)
我忘记了xml的一部分。我必须添加以下内容:
<gedmo:loggable log-entry-class="Log\Location"/>
其中log-entry-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="Base\Activity\Organisation" table="activity_organisation">
<gedmo:loggable log-entry-class="Log\Location"/>
<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>