mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
exports: DurationAggregator: test qb addSelect for compute date interval
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace Chill\MainBundle\Doctrine\DQL;
|
||||
|
||||
use Doctrine\ORM\Query\AST\Functions\DateDiffFunction;
|
||||
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
|
||||
use Doctrine\ORM\Query\AST\Node;
|
||||
use Doctrine\ORM\Query\AST\PathExpression;
|
||||
use Doctrine\ORM\Query\Lexer;
|
||||
use Doctrine\ORM\Query\Parser;
|
||||
@@ -12,13 +14,17 @@ use Doctrine\ORM\Query\SqlWalker;
|
||||
* Extract postgresql function
|
||||
* https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT
|
||||
*
|
||||
* Usage : EXTRACT(field FROM value)
|
||||
* Usage : EXTRACT(field FROM timestamp)
|
||||
* TODO allow interval usage -> EXTRACT(field FROM interval)
|
||||
*/
|
||||
class Extract extends FunctionNode
|
||||
{
|
||||
private string $field;
|
||||
|
||||
private PathExpression $value;
|
||||
private $value;
|
||||
//private PathExpression $value;
|
||||
//private FunctionNode $value;
|
||||
//private DateDiffFunction $value;
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
{
|
||||
@@ -39,7 +45,8 @@ class Extract extends FunctionNode
|
||||
|
||||
$parser->match(Lexer::T_FROM);
|
||||
|
||||
$this->value = $parser->ScalarExpression();
|
||||
//$this->value = $parser->ScalarExpression();
|
||||
$this->value = $parser->ArithmeticPrimary();
|
||||
|
||||
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
|
||||
}
|
||||
|
Reference in New Issue
Block a user