-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
| Q | A |
|---|---|
| Bug? | yes |
| New Feature? | no |
| Community Bundle Version | 2.0@dev: 17e2867 |
| Sulu Version | - |
| Browser Version | - |
Actual Behavior
The current bundle version is not working on postgres as the SQL errors with:
Expected Behavior
It should not error.
Steps to Reproduce
What are the steps to reproduce this bug? Please add code examples,
screenshots or links to GitHub repositories that reproduce the problem.
Possible Solutions
<?php
namespace App\Doctrine\Extension\Postgresql;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;
class SimilarTo extends FunctionNode
{
public $value = null;
public $regexp = null;
public function parse(Parser $parser): void
{
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);
$this->value = $parser->StringPrimary();
$parser->match(TokenType::T_COMMA);
$this->regexp = $parser->StringExpression();
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}
public function getSql(SqlWalker $sqlWalker): string
{
return '(' . $this->value->dispatch($sqlWalker) . ' SIMILAR TO ' . $this->regexp->dispatch($sqlWalker) . ')';
}
}doctrine:
orm:
dql:
string_functions: App\Doctrine\Extension\Postgresql\SimilarTo Metadata
Metadata
Assignees
Labels
No labels
