mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
44 lines
1.0 KiB
PHP
44 lines
1.0 KiB
PHP
<?php
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Chill\MainBundle\Doctrine\DQL;
|
|
|
|
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
|
|
use Doctrine\ORM\Query\Lexer;
|
|
|
|
class Similarity extends FunctionNode
|
|
{
|
|
private $firstPart;
|
|
|
|
private $secondPart;
|
|
|
|
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
|
{
|
|
return 'SIMILARITY(' . $this->firstPart->dispatch($sqlWalker) .
|
|
', ' . $this->secondPart->dispatch($sqlWalker) . ')';
|
|
}
|
|
|
|
public function parse(\Doctrine\ORM\Query\Parser $parser)
|
|
{
|
|
$parser->match(Lexer::T_IDENTIFIER);
|
|
$parser->match(Lexer::T_OPEN_PARENTHESIS);
|
|
|
|
$this->firstPart = $parser->StringPrimary();
|
|
|
|
$parser->match(Lexer::T_COMMA);
|
|
|
|
$this->secondPart = $parser->StringPrimary();
|
|
|
|
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
|
|
}
|
|
}
|