Doctrine 2 doesn't support REGEXP out of the box, but you can add a custom 
function [1] yourself.

Next you can use the QueryBuilder [2] to dynamically build the query you need.

[1]: 
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#adding-your-own-functions-to-the-dql-language
[2]: 
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/query-builder.html

--  
Jasper N. Brouwer
(@jaspernbrouwer)


On 19 December 2014 at 20:34:12, Pablo ([email protected]) wrote:
> I think I have a serious problem.
>  
> As I am migrating from MySQL to multiple banks, the old system there was
> the following statement which had a seat speaker array and an array of
> search terms.
>  
> He wore REGEXP to search all the columns the values of research.
>  
> Will can do something equivalent with DBAL?
>  
> in fact need to know how can I do a sort of "like in" with doctrine.
>  
> $columns = ['name', 'surname', 'age'];
> $search = ['pablo', 'maria'];
>  
>  
> the method below shows how I was doing with pure sql, this method just
> returns me part of the string sql.
> private function sqlBuscaGeral ($ filtroDinamico)
> {
> $buscaGral = \ filter_input (\INPUT_GET, 'sisBuscaGeral');
>  
> if ($buscaGral) {
> $sql = 'AND (';
>  
> $fields = \str_replace (',', '|', $buscaGral);
>  
> $total = \ count ($ filtroDinamico);
> $count = 0;
> foreach ($filtroDinamico the $column => $aliasSql) {
> $cont ++;
>  
> $alias = $aliasSql ? $aliasSql. '.' : '';
>  
> $sql. = $alias. $column. "REGEXP '." $fields. "'";
>  
> $sql. = $total == $cont ? '', 'OR';
> }
>  
> $sql = ').';
> }
>  
> return $sql;
> }


-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to