Multiple parameters in where clause
I need to add some parameters for the where clause. Is there any way to achieve this with Propel. It gives me,
Criteria: (Error: Could not generate SQL for expression "LATITUDE" because Criteria :: RAW only works on a sentence containing a single-task question mark)
This is my request.
$userArray = UserQuery::create()
->where('( 3959 * acos( cos( radians(?) )
* cos( radians( User.latitude ) )
* cos( radians( User.longitude ) - radians(?) )
+ sin( radians(?) )
* sin( radians( User.latitude) ) ) ) > 10',
$user->getLatitude(),
$user->getLongitude(),
$user->getLatitude()
)->find();
+3
source to share
2 answers
For anyone else linking to this. I was able to achieve this using the following code.
$userArray = UserQuery::create()->where('( 3959 * acos( cos( radians(?) )
* cos( radians( User.latitude ) )
* cos( radians( User.longitude ) - radians(?) )
+ sin( radians(?) )
* sin( radians( User.latitude) ) ) ) < 10000',
array($user->getLatitude(),
$user->getLongitude(),
$user->getLatitude()))->find();
0
source to share