The query is not entirely correct. It works like this:

    $qb
        ->select('alias')
        ->from('entity_classname', 'alias')
        ->where($qb->expr()->eq('alias.property', ':parameter'))
        ->setParameter('parameter', $value);

In your case probably something like this:

    $qb
        ->select('m')
        ->from('Modulo', 'm')
        ->where($qb->expr()->eq('m.moduloCod', ':moduloCod'))
        ->setParameter('moduloCod', $cod);

--  
Jasper N. Brouwer
(@jaspernbrouwer)


On 18 December 2014 at 15:37:01, Pablo ([email protected]) wrote:
> I'm trying to use safe mode parameter of the where clause.
>  
> but when I write the query does not replace the parameter.
>  
> I think I'm missing something.
>  
> $qb->select('moduloCod')
> ->from('_modulo', '')
> ->where($qb->expr()->eq('moduloCod', ':moduloCod'))
> ->setParameter('moduloCod', $cod);
>  
> echo $qb;
> SELECT moduloCod FROM _modulo WHERE moduloCod = :moduloCod
>  
> expected return:
> SELECT moduloCod FROM _modulo WHERE moduloCod = 1
>  
>  
> sorry the difficult days of a beginner.


-- 
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