l3pp4rd/DoctrineExtensions — Issue #197: [sortable] Error when removing entity
Author: dzsii
Created: 2011-11-27 17:44:57+00:00
State: open

I have class table inheritance between two classes and sortable extension on the child class.

When I try to remove an entity, i got the following exception from Doctrine (2.1.4):

Uncaught exception: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
The exception was thrown on line: 707 in /usr/local/pear/share/pear/Doctrine/DBAL/Connection.php
#0 /usr/local/pear/share/pear/Doctrine/DBAL/Connection.php(707): PDOStatement->execute()
#1 /usr/local/pear/share/pear/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php(162): Doctrine\DBAL\Connection->executeUpdate('INSERT INTO Com...', Array, Array)
#2 /usr/local/pear/share/pear/Doctrine/ORM/Query.php(249): Doctrine\ORM\Query\Exec\MultiTableUpdateExecutor->execute(Object(Doctrine\DBAL\Connection), Array, Array)
#3 /usr/local/pear/share/pear/Doctrine/ORM/AbstractQuery.php(607): Doctrine\ORM\Query->_doExecute()
#4 /usr/local/pear/share/pear/Doctrine/ORM/AbstractQuery.php(413): Doctrine\ORM\AbstractQuery->execute(Array, 1)
#5 /home/thinkbig/progress/web/_plugins/DoctrineExtensions/lib/Gedmo/Sortable/SortableListener.php(304): Doctrine\ORM\AbstractQuery->getResult()
#6 /home/thinkbig/progress/web/_plugins/DoctrineExtensions/lib/Gedmo/Sortable/SortableListener.php(104): Gedmo\Sortable\SortableListener->processRelocations(Object(Doctrine\ORM\EntityManager))
#7 /usr/local/pear/share/pear/Doctrine/Common/EventManager.php(64): Gedmo\Sortable\SortableListener->onFlush(Object(Doctrine\ORM\Event\OnFlushEventArgs))
#8 /usr/local/pear/share/pear/Doctrine/ORM/UnitOfWork.php(280): Doctrine\Common\EventManager->dispatchEvent('onFlush', Object(Doctrine\ORM\Event\OnFlushEventArgs))
#9 /usr/local/pear/share/pear/Doctrine/ORM/EntityManager.php(334): Doctrine\ORM\UnitOfWork->commit()

As I could find out, the listener sets 3 parameters for it's update, but Doctrine expects only two for it's temp table insert.