Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed ArchivableBehavior archived_at (Refs #309)

  • Loading branch information...
commit 769dbf9274658a95e7203481ee30ec239e4cc5b9 1 parent 45f418b
@akalyaev akalyaev authored
View
4 generator/lib/behavior/archivable/ArchivableBehavior.php
@@ -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'));
}
}
View
8 test/testsuite/generator/behavior/archivable/ArchivableBehaviorObjectBuilderModifierTest.php
@@ -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'));
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.