WIP: Symfony 6 project remake #2
|
@ -1,15 +1,17 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace src\PointToolsBundle\DQL;
|
||||
namespace App\Doctrine\DQL;
|
||||
|
||||
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
|
||||
use Doctrine\ORM\Query\Lexer;
|
||||
use Doctrine\ORM\Query\{Lexer, Parser, SqlWalker};
|
||||
|
||||
/** TODO: check if still needed */
|
||||
class Day extends FunctionNode
|
||||
{
|
||||
public $dateExpression;
|
||||
|
||||
public function parse(\Doctrine\ORM\Query\Parser $parser)
|
||||
public function parse(Parser $parser): void
|
||||
{
|
||||
$parser->match(Lexer::T_IDENTIFIER);
|
||||
$parser->match(Lexer::T_OPEN_PARENTHESIS);
|
||||
|
@ -19,7 +21,7 @@ class Day extends FunctionNode
|
|||
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
|
||||
}
|
||||
|
||||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
return 'date_trunc(\'day\', '.$this->dateExpression->dispatch($sqlWalker).')';
|
||||
}
|
Loading…
Reference in a new issue