I'm trying to get a video from my video database, the selection is based on a unique combination of external_id
and language_id
(both integers). I tried the following code, but it looks like findFirst()
only picks up the first criterium
$video = Video::findFirst("language_id=" . $language->id . " and external_id=" . $external->id);
Can anybody help me how to properly use findFirst with multiple criteria?
Try binding your parameters vs. concatenating them. Safer and it might identify an error area
$video = Video::findFirst(
[
'columns' => '*',
'conditions' => 'language_id = ?1 AND external_id = ?2',
'bind' => [
1 => $language->id,
2 => $external->id,
]
]
);