Skip to content
This repository
Browse code

Merge pull request #310 from akalyaev/master

fixes Archivable behavior
  • Loading branch information...
commit 356947af6b1892f7f6d8379b4a3c5f6dac157eb7 2 parents 3231a76 + 38738e6
William Durand authored March 08, 2012
4  generator/lib/behavior/archivable/ArchivableBehavior.php
@@ -159,8 +159,8 @@ public function hasArchiveClass()
159 159
 	 */
160 160
 	public function getArchivedAtColumn()
161 161
 	{
162  
-		if ($this->getParameter('log_archived_at') == 'true') {
163  
-			return $this->getTable()->getColumn($this->getParameter('archived_at_column'));
  162
+		if ($this->getArchiveTable() && $this->getParameter('log_archived_at') == 'true') {
  163
+			return $this->getArchiveTable()->getColumn($this->getParameter('archived_at_column'));
164 164
 		}
165 165
 	}
166 166
 
9  test/testsuite/generator/behavior/archivable/ArchivableBehaviorObjectBuilderModifierTest.php
@@ -378,6 +378,15 @@ public function testDeleteWithoutArchiveDoesNotCreateArchive()
378 378
 		$this->assertEquals(0, ArchivableTest10ArchiveQuery::create()->count());
379 379
 	}
380 380
 
  381
+  public function testArchiveSetArchivedAtToTheCurrentTime()
  382
+  {
  383
+    $a = new ArchivableTest10();
  384
+    $a->setTitle('foo');
  385
+    $a->save();
  386
+    $ret = $a->archive();
  387
+    // time without seconds
  388
+    $this->assertEquals(date('Y-m-d H:i'), $ret->getArchivedAt('Y-m-d H:i'));
  389
+  }
381 390
 }
382 391
 
383 392
 

0 notes on commit 356947a

Please sign in to comment.
Something went wrong with that request. Please try again.