You cannot use native SQL and DQL together.
You either use native SQL queries, _or_ DQL queries.
What is it you want to query?
Maybe we can help you with finding the correct DQL statements?
PS: You should also never concatenate values into your queries, but use
parameters in stead.
So this:
$qb->where(
$qb->expr()->like($cbus, $qb->expr()->literal('%' . $termoBusca . '%'))
);
Should be this:
$qb->where(
$qb->expr()->like($cbus, ':termoBusca')
);
$qb->setParameter('termoBusca', '%' . $termoBusca . '%');
--
Jasper N. Brouwer
(@jaspernbrouwer)
On 16 December 2014 at 15:45:30, Pablo ([email protected]) wrote:
> Hello everybody,
>
> how could I put a native mysql-statement in where clause using the query
> builder.
>
> example:
>
> $ sql = $ qb-> select ($ CCOD. "the cod ', $ CDES.' the DSC ')
> -> from ($ table, '')
> -> where ($ qb-> expr () -> like ($ cbus, $ qb-> expr () -..> literal ('%'
> $ termoBusca '%')))
> * -> 'my native string'*
> -> setMaxResults ($ limit);
--
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.