DDC-1069: setParameter[s]() examples on DQL page uses ":" even though that is not supported #1661

doctrinebot opened this Issue Mar 13, 2011 · 5 comments

2 participants


Jira issue originally created by user anderom:


Among others:
$query = $em->createQuery('SELECT u from ForumUser u WHERE (u.username = :name OR u.username = :name2) AND u.id = :id');
':name' => 'Bob',
':name2' => 'Alice',
':id' => 321,

Despite this does not work and doc says "When referencing the parameters in Query#setParameter($param, $value) both named and positional parameters are used without their prefixies." on same page.
(side note: prefixies => prefixes)

Fresh on doctrine 2.0 you typically copy past examples to try out stuff, and when exception then says that ":id" is not a valid param on this query you end up not knowing what went wrong.


Comment created by mridgway:

I posted a simple patch for this at doctrine/orm-documentation#20


Comment created by anderom:

Looks good!


Comment created by @beberlei:



Issue was closed with resolution "Fixed"


Comment created by naitsirch:

You can find the same error in the PHPDoc* of the methods setParameter(...) and setParameters(..) in class *Doctrine\ORM\QueryBuilder.

* <code>
*     $qb = $em->createQueryBuilder()
*         ->select('u')
*         ->from('User', 'u')
*         ->where('u.id = :user_id')
*         ->setParameter(':user_id', 1);
* </code>

It would be nice if this will be fixed, because it is confusing, if you look at the autocomplete notice of the IDEs.

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.0.4 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment