Поведение архива Propel не работает должным образом (столбец archived_at не обновляется при вставке) - PullRequest
0 голосов
/ 05 марта 2012

У меня есть некоторые проблемы с архивируемым поведением 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 :: метод архива:

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 столбец определенно существует в моей таблице semin_customer_archive.

Кто-нибудь знает, что я делаю неправильно?Или, может быть, в схеме есть ошибка?

  • Symfony: 1.4.17-DEV
  • Propel: 1.6.3

Заранее спасибо!

1 Ответ

0 голосов
/ 05 марта 2012

Вы можете принудительно установить параметр log_archived_at в архивируемом поведении? Это должно работать из коробки ...

Если это может помочь, вот документация: http://www.propelorm.org/behaviors/archivable.html

РЕДАКТИРОВАТЬ: исправлено PR # 310

...