spotorm / spot2

Spot v2.x DataMapper built on top of Doctrine's Database Abstraction Layer
http://phpdatamapper.com
BSD 3-Clause "New" or "Revised" License
601 stars 101 forks source link

Query::whereFieldSql bug when providing more than one parameter #228

Closed marcojetson closed 6 years ago

marcojetson commented 7 years ago

Query::whereFieldSql fails to populate more than one placeholder

e.g.

$query->whereFieldSql('DATE(created)', 'BETWEEN ? AND ?', ['2016-01-01', '2017-01-01']);

results in "WHERE DATE(created) BETWEEN '2016-01-01' AND '2016-01-01'" because callback is shifting from $params but $params is not passing by reference... so it's just using first value every time

tuupola commented 7 years ago

What does this PR do?

vlucas commented 7 years ago

@marcojetson Can you please add a test for this - preferably a test that would not pass before, and one that does now with these new changes?

tuupola commented 7 years ago

@marcojetson Can you add tests for this?