public function findPolicyIds($coverageId = null) {
$id = $this->Policy->find('all', array(
'recursive' => -1,
'conditions' => array('Policy.coverage_id' => $coverageId),
'fields' => array('Policy.id')
));
return $id;
}
Cakephp Find Equal Operator
-
04-06-2022 - |
Question
I am trying to retrieve one column of ids based on a parameter being passed into my function. I want to retrieve all policy ids that have the same Coverageid that is being passed in. This is what Ive tried. I believe my Operator is in the wrong place. The reason being is when I run my script all my policies return instead of the the policies with the coverage id being passed in. I have looked around on the net but can't seem to find anything that can help me besides the PHP and Cakephp Manuals.
public function findPolicyIds($coverageId = null) {
$id = $this->Policy->find('all', array(
'recursive' => -1, array(
'condition' => array('Policy.coverage_id == ' => '$coverageId',
'fields' => array('Policy.id'))));
return $id;
}
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow