DDC-749: positional query parameters throwing a QueryException #922

Closed
opened 2026-01-22 12:55:40 +01:00 by admin · 7 comments
Owner

Originally created by @doctrinebot on GitHub (Aug 17, 2010).

Jira issue originally created by user goriol:

I get the following exception:
"Invalid parameter number: number of bound variables does not match number of tokens"
when executing the following Doctrine query:

$em = $this->_getEntityManager();
$query = $em->createQuery('select e from Domain*Entity*Country e where e.alpha2Code like ?1');
$query->setParameters(array(1 => 'A%')); 
Originally created by @doctrinebot on GitHub (Aug 17, 2010). Jira issue originally created by user goriol: I get the following exception: "Invalid parameter number: number of bound variables does not match number of tokens" when executing the following Doctrine query: ``` $em = $this->_getEntityManager(); $query = $em->createQuery('select e from Domain*Entity*Country e where e.alpha2Code like ?1'); $query->setParameters(array(1 => 'A%')); ```
admin added the Bug label 2026-01-22 12:55:40 +01:00
admin closed this issue 2026-01-22 12:55:40 +01:00
Author
Owner

@doctrinebot commented on GitHub (Sep 12, 2010):

Comment created by @beberlei:

I cannot reproduce this sorry, can you retry with Beta4?

@doctrinebot commented on GitHub (Sep 12, 2010): Comment created by @beberlei: I cannot reproduce this sorry, can you retry with Beta4?
Author
Owner

@doctrinebot commented on GitHub (Sep 14, 2010):

Comment created by goriol:

Hi Benjamin,

I made a new test and got the same error with BETA4.

Here is the stack trace:
Invalid parameter number: number of bound variables does not match number of tokens
#0 /Users/goriol/src/Doctrine/doctrine-orm-2.0.0BETA4/Doctrine/ORM/Query.php(229): Doctrine\ORM\Query\QueryException::invalidParameterNumber()
#1 /Users/goriol/src/Doctrine/doctrine-orm-2.0.0BETA4/Doctrine/ORM/AbstractQuery.php(528): Doctrine\ORM\Query->_doExecute()
#2 /Users/goriol/src/Doctrine/doctrine-orm-2.0.0BETA4/Doctrine/ORM/AbstractQuery.php(408): Doctrine\ORM\AbstractQuery->execute(Array, 4)
#3 /Users/goriol/src/Doctrine/doctrine-orm-2.0.0BETA4/Doctrine/ORM/AbstractQuery.php(434): Doctrine\ORM\AbstractQuery->getSingleResult(4)
#4 /Users/goriol/src/DoctrineExtensions/lib/DoctrineExtensions/Paginate/PaginationAdapter.php(82): Doctrine\ORM\AbstractQuery->getSingleScalarResult()
#5 /Users/goriol/src/DoctrineExtensions/lib/DoctrineExtensions/Paginate/PaginationAdapter.php(134): DoctrineExtensions\Paginate\PaginationAdapter->setRowCount(Object(Doctrine\ORM\Query))
#6 /Users/goriol/src/Zend/ZendFramework-1.10.5/library/Zend/Paginator.php(1028): DoctrineExtensions\Paginate\PaginationAdapter->count()
#7 /Users/goriol/src/Zend/ZendFramework-1.10.5/library/Zend/Paginator.php(712): Zend_Paginator->_calculatePageCount()
#8 /Users/goriol/src/Technema/Service/Doctrine.php(285): Zend_Paginator->setItemCountPerPage(30)
#9 /Users/goriol/src/Technema/Controller/Rest.php(85): Technema_Service_Doctrine->fetchPage(Array)
#10 /Users/goriol/src/Zend/ZendFramework-1.10.5/library/Zend/Controller/Action.php(513): Technema_Controller_Rest->indexAction()
#11 /Users/goriol/src/Zend/ZendFramework-1.10.5/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('indexAction')
#12 /Users/goriol/src/Zend/ZendFramework-1.10.5/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#13 /Users/goriol/src/Zend/ZendFramework-1.10.5/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#14 /Users/goriol/src/Zend/ZendFramework-1.10.5/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#15 /private/var/www/erp.alterimago.com/public/index.php(24): Zend_Application->run()
#16 {main}

@doctrinebot commented on GitHub (Sep 14, 2010): Comment created by goriol: Hi Benjamin, I made a new test and got the same error with BETA4. Here is the stack trace: Invalid parameter number: number of bound variables does not match number of tokens #0 \/Users\/goriol\/src\/Doctrine\/doctrine-orm-2.0.0BETA4\/Doctrine\/ORM\/Query.php(229): Doctrine\ORM\Query\QueryException::invalidParameterNumber() #1 \/Users\/goriol\/src\/Doctrine\/doctrine-orm-2.0.0BETA4\/Doctrine\/ORM\/AbstractQuery.php(528): Doctrine\ORM\Query->_doExecute() #2 \/Users\/goriol\/src\/Doctrine\/doctrine-orm-2.0.0BETA4\/Doctrine\/ORM\/AbstractQuery.php(408): Doctrine\ORM\AbstractQuery->execute(Array, 4) #3 \/Users\/goriol\/src\/Doctrine\/doctrine-orm-2.0.0BETA4\/Doctrine\/ORM\/AbstractQuery.php(434): Doctrine\ORM\AbstractQuery->getSingleResult(4) #4 \/Users\/goriol\/src\/DoctrineExtensions\/lib\/DoctrineExtensions\/Paginate\/PaginationAdapter.php(82): Doctrine\ORM\AbstractQuery->getSingleScalarResult() #5 \/Users\/goriol\/src\/DoctrineExtensions\/lib\/DoctrineExtensions\/Paginate\/PaginationAdapter.php(134): DoctrineExtensions\Paginate\PaginationAdapter->setRowCount(Object(Doctrine\ORM\Query)) #6 \/Users\/goriol\/src\/Zend\/ZendFramework-1.10.5\/library\/Zend\/Paginator.php(1028): DoctrineExtensions\Paginate\PaginationAdapter->count() #7 \/Users\/goriol\/src\/Zend\/ZendFramework-1.10.5\/library\/Zend\/Paginator.php(712): Zend_Paginator->_calculatePageCount() #8 \/Users\/goriol\/src\/Technema\/Service\/Doctrine.php(285): Zend_Paginator->setItemCountPerPage(30) #9 \/Users\/goriol\/src\/Technema\/Controller\/Rest.php(85): Technema_Service_Doctrine->fetchPage(Array) #10 \/Users\/goriol\/src\/Zend\/ZendFramework-1.10.5\/library\/Zend\/Controller\/Action.php(513): Technema_Controller_Rest->indexAction() #11 \/Users\/goriol\/src\/Zend\/ZendFramework-1.10.5\/library\/Zend\/Controller\/Dispatcher\/Standard.php(295): Zend_Controller_Action->dispatch('indexAction') #12 \/Users\/goriol\/src\/Zend\/ZendFramework-1.10.5\/library\/Zend\/Controller\/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #13 \/Users\/goriol\/src\/Zend\/ZendFramework-1.10.5\/library\/Zend\/Application\/Bootstrap\/Bootstrap.php(97): Zend_Controller_Front->dispatch() #14 \/Users\/goriol\/src\/Zend\/ZendFramework-1.10.5\/library\/Zend\/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #15 \/private\/var\/www\/erp.alterimago.com\/public\/index.php(24): Zend_Application->run() #16 {main}
Author
Owner

@doctrinebot commented on GitHub (Sep 14, 2010):

Comment created by @beberlei:

That stack trace puts the report in a new light, your code example is not really the source of the error but the pagination adapter is.

@doctrinebot commented on GitHub (Sep 14, 2010): Comment created by @beberlei: That stack trace puts the report in a new light, your code example is not really the source of the error but the pagination adapter is.
Author
Owner

@doctrinebot commented on GitHub (Sep 14, 2010):

Comment created by @beberlei:

This is a Doctrine Extensions paginator bug, closing the issue here, its known in the extension already.

@doctrinebot commented on GitHub (Sep 14, 2010): Comment created by @beberlei: This is a Doctrine Extensions paginator bug, closing the issue here, its known in the extension already.
Author
Owner

@doctrinebot commented on GitHub (Sep 14, 2010):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Sep 14, 2010): Issue was closed with resolution "Invalid"
Author
Owner

@doctrinebot commented on GitHub (Sep 14, 2010):

Comment created by goriol:

Are you talking about this issue?
http://github.com/beberlei/DoctrineExtensions/issues#issue/10

@doctrinebot commented on GitHub (Sep 14, 2010): Comment created by goriol: Are you talking about this issue? http://github.com/beberlei/DoctrineExtensions/issues#issue/10
Author
Owner

@doctrinebot commented on GitHub (Sep 15, 2010):

Comment created by @beberlei:

yes thats the one

@doctrinebot commented on GitHub (Sep 15, 2010): Comment created by @beberlei: yes thats the one
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#922