Basically, the approach you took is fine. However, I see at least two things wrong.
1) Doctrine does not support BETWEEN, so you will need something like:
$testquery .= " and p.price >= :minprice AND p.price <= :maxprice";
2) .. = - only a string operator, you cannot use it with arrays. This way, you will need to do something like this (you can do array_merge, but this seems like overkill):
$testParam['minPrice'] = $minPrice; $testParam['maxPrice'] = $maxPrice;
source share