Permalink
Browse files

fixed ArchivableBehavior archived_at (Refs #309)

  • Loading branch information...
1 parent 45f418b commit 769dbf9274658a95e7203481ee30ec239e4cc5b9 @melekes melekes committed Mar 6, 2012
@@ -159,8 +159,8 @@ public function hasArchiveClass()
*/
public function getArchivedAtColumn()
{
- if ($this->getParameter('log_archived_at') == 'true') {
- return $this->getTable()->getColumn($this->getParameter('archived_at_column'));
+ if ($this->getParameter('log_archived_at') == 'true' && $this->getArchiveTable()) {
+ return $this->getArchiveTable()->getColumn($this->getParameter('archived_at_column'));
}
}
@@ -378,6 +378,14 @@ public function testDeleteWithoutArchiveDoesNotCreateArchive()
$this->assertEquals(0, ArchivableTest10ArchiveQuery::create()->count());
}
+ public function testArchiveSetArchivedAtToTheCurrentTime() {
+ $a = new ArchivableTest10();
+ $a->setTitle('foo');
+ $a->save();
+ $ret = $a->archive();
+ // time without seconds
+ $this->assertEquals(date('Y-m-d H:i'), $ret->getArchivedAt('Y-m-d H:i'));
+ }
}

0 comments on commit 769dbf9

Please sign in to comment.