Hi all,

I'm using sfDoctrine and have the following problem concerning
prepared statements and Doctrine::FETCH_ARRAY. I wrote:

$q = new Doctrine_Query();
...
->where('utc.community_id = :cid AND utc.role = 0', array(':cid'=>
$cid));//$cid = 3
...
$founder = $q->execute(array(1), Doctrine::FETCH_ARRAY);

The array contains 1 alias :cid.
Symfony throws an exception then:

[Doctrine_Connection_Mysql_Exception]
SQLSTATE[HY093]: Invalid parameter number: number of bound variables
does not match number of tokens
...
at Doctrine_Connection->execute('SELECT DISTINCT u3.id FROM user u3
INNER JOIN user_to_community u4 ON u3.id = u4.user_id WHERE
(u4.community_id = :cid AND u4.role = 0) LIMIT 1', array(':cid' =>
'3', '1'))

What happens is that the array containing the alias :cid is filled
with with the "1" from the array in the execute-function.
So writing $founder = $q->execute(array(2), Doctrine::FETCH_ARRAY)
leads to:
... array(':cid' => '3', '2')

Does anybody know this problem? Is that a PDO or a Doctrine bug?

Regards,
Johannes


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to