Propel可存档行为无法正常工作(archived_at列在插入时不会更新)

时间:2012-03-05 12:08:54

标签: symfony1 symfony-1.4 propel

我对Propel的可存档行为有一些问题。出于某些原因,Propel不会在归档对象时将archived_at字段设置为当前日期时间。

我的架构:

SeminarCustomer:
  tableName:          seminar_customer
  columns:
    id:              { type: integer, required: true, primaryKey: true, foreignClass: Customer, foreignReference: id, onDelete: cascade }
    ...
    office_id:       { type: integer, required: false, foreignTable: office, foreignReference: id }
    entity_id:       { type: integer, required: true, default: 1 }
  propel_behaviors:
    timestampable:   ~
    archivable:      ~

SeminarCustomer :: archive方法:

public function archive(PropelPDO $con = null)
{
    if ($this->isNew()) {
        throw new PropelException('New objects cannot be archived. You must save the current object before calling archive().');
    }
    if (!$archive = $this->getArchive($con)) {
        $archive = new SeminarCustomerArchive();
        $archive->setPrimaryKey($this->getPrimaryKey());
    }
    $this->copyInto($archive, $deepCopy = false, $makeNew = false);
            // NOTE: here should be $archive->setArchivedAt(time());
    $archive->save($con);

    return $archive;
}

archived_at列肯定存在于我的seminar_customer_archive表中。

有人知道我做错了什么吗?或者模式中可能存在错误?

  • Symfony:1.4.17-DEV
  • 推动:1.6.3

提前致谢!

1 个答案:

答案 0 :(得分:0)

你可以强制Archivable行为的log_archived_at参数吗?它应该开箱即用......

如果可以提供帮助,请参阅以下文档:http://www.propelorm.org/behaviors/archivable.html

编辑:由PR #310

修复