I see. the real issue is setParameter doesn't strip leading colon.

Also the phpdoc makes it look like you're supposed to pass in ":name"
https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Query/QueryBuilder.php#L262

I'll send a PR.

Steve

> On Mar 31, 2016, at 6:57 AM, Marco Pivetta <[email protected]> wrote:
> 
> "dcValue1" is indeed correct, as that's the name of the parameter, while ":" 
> is just a marker, like "$" in php. You mentioned a case where binding to 
> ":test" (colon included) works: I am worried about that one instead.
> 
>> On Mar 31, 2016 12:52, "Steve Clay" <[email protected]> wrote:
>> See 
>> https://github.com/doctrine/dbal/blob/master/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php#L595
>> 
>> The tests mask the issue by calling  getParameter('dcValue1') instead of 
>> getParameter(':dcValue1').
>> 
>> I'll send a fix, but my worry is users expect these params named without the 
>> colon. I'm guessing the API reading them for queries must be silently 
>> normalizing the names.
>> 
>> Steve
>> 
>>> On Mar 31, 2016, at 1:12 AM, Marco Pivetta <[email protected]> wrote:
>>> 
>>> Could you make an actual reproducible example/test-case? Sounds like a bug, 
>>> if `:` is considered only in some cases.
>>> 
>>> Marco Pivetta 
>>> 
>>> http://twitter.com/Ocramius      
>>> 
>>> http://ocramius.github.com/
>>> 
>>>> On 31 March 2016 at 06:13, Steve Clay <[email protected]> wrote:
>>>> Hello,
>>>> 
>>>> In QueryBuilder, createNamedParameter() creates placeholders like 
>>>> ":dcValue1" but in the parameters array the key is missing the colon 
>>>> ("dcValue1").
>>>> Whereas setParameter(':test') sets the param with the expected key ":test".
>>>> 
>>>> Why does createNamedParameter() strip the leading colon from the key name? 
>>>> Someone could easily end up with a params array where some keys lead with 
>>>> ":" and others don't.
>>>> 
>>>> Steve
>>>> -- 
>>>> 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 https://groups.google.com/group/doctrine-user.
>>>> For more options, visit https://groups.google.com/d/optout.
>>> 
>>> -- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "doctrine-user" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/doctrine-user/Zn5NTfaMd8E/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/doctrine-user.
>>> For more options, visit https://groups.google.com/d/optout.
>> 
>> -- 
>> 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 https://groups.google.com/group/doctrine-user.
>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "doctrine-user" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/doctrine-user/Zn5NTfaMd8E/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/doctrine-user.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to