Skip to content

Commit

Permalink
Merge pull request #135 from tsukasa-mixer/master
Browse files Browse the repository at this point in the history
fix: DateTime getValue -> AutoNow|AutoNowAdd
  • Loading branch information
Maxim authored Jul 1, 2016
2 parents b8d733e + deb50f8 commit 3a70341
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Mindy/Orm/Fields/DateField.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,13 @@ public function onBeforeUpdate()
public function getValue()
{
$db = ConnectionManager::getDb()->getQueryBuilder();
if (
is_numeric($this->value) ||
$this->autoNowAdd && $this->getModel()->getIsNewRecord() ||
$this->autoNow
) {
if ($this->autoNowAdd && $this->getModel()->getIsNewRecord() || $this->autoNow) {
return $db->convertToDate();
}
if ( is_numeric($this->value) ) {
return $db->convertToDate($this->value);
} else {
return $this->value;
}
return $this->value;
}

public function toArray()
Expand Down

0 comments on commit 3a70341

Please sign in to comment.