Skip to content
This repository has been archived by the owner on Nov 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #250 from alcaeus/fix-dateToString-operator
Browse files Browse the repository at this point in the history
Fix wrong syntax for dateToString operator
  • Loading branch information
malarzm committed Feb 17, 2016
2 parents d540f7f + 108d486 commit e5062a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/MongoDB/Aggregation/Expr.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ private function ensureArray($expression)
*/
public function dateToString($format, $expression)
{
return $this->operator('$dateToString', array($format, $expression));
return $this->operator('$dateToString', array('format' => $format, 'date' => $expression));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/MongoDB/Tests/Aggregation/ExprTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testDateToString()
$expr = new Expr();

$this->assertSame($expr, $expr->dateToString('%Y-%m-%d', '$dateField'));
$this->assertSame(array('$dateToString' => array('%Y-%m-%d', '$dateField')), $expr->getExpression());
$this->assertSame(array('$dateToString' => array('format' => '%Y-%m-%d', 'date' => '$dateField')), $expr->getExpression());
}

public function testDayOfMonth()
Expand Down

0 comments on commit e5062a4

Please sign in to comment.