Git Repository Public Repository

namibia

URLs

Copy to Clipboard
 
df0489e1eeeeab5a9bd44e1d84fce49924fe1bac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

namespace UVd\DoctrineFunction;

use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;

/**
 * SOUNDEX
 *
 * Allows Doctrine 2.0 Query Language to execute a MySQL SOUNDEX function
 * You must boostrap this function in your ORM as a DQLFunction.
 *
 */
class Soundex extends FunctionNode
{
	public $stringExpression = null;
	public function parse(\Doctrine\ORM\Query\Parser $parser)
	{
		$parser->match(Lexer::T_IDENTIFIER);
		$parser->match(Lexer::T_OPEN_PARENTHESIS);
		$this->stringExpression = $parser->StringPrimary();
		$parser->match(Lexer::T_CLOSE_PARENTHESIS);
	}
	public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
	{
		return 'SOUNDEX(' .
				$this->stringExpression->dispatch($sqlWalker) .
				')';
	}
}

Commits for namibiamodule/Utility/src/Utility/DoctrineFunction/Soundex.php

Diff revisions: vs.
Revision Author Commited Message
df0489 ... Mark Fri 14 Oct, 2016 10:01:00 +0000

initial commit