I can't retrieve documents using finFIrst. I use the primary key compsed of three elements from my table of eight rows. This is the code:
public function findAction($establishment_id, $city, $district) {
echo "here";
$branch= Branch::findFirst(
[
'columns'=> '*',
'conditions' => 'establishment_id= ?1 AND city=?2 AND district= ?3',
'bind' =>[
1=>$establishment_id->establishment_id,
2=>$city->city,
3=>$district->district
]
]
);
if ($branch === false) {
$this->response->setJsonContent(
[
"status" => "NOT-FOUND"
]
);
} else {
$this->response->setJsonContent(
[
"status" => "FOUND",
"data" => [
"establishment_id" => $branch->establishment_id,
"city" => $branch->city,
"district"=>$branch->district
]
]
);
}
return $this->response;
}
When I comment the lines of 'bind' the echo above shows, but when I uncomment it I have false. What could be the issue ?