Find()->count() gives InvalidArgumentException

I am really feeling stupid, but I do not manage to count. What am I doing wrong here?

In my controller:
(as written in Query Builder - 4.x)

$this->loadModel(‘Measurements’);
$total = $this->Measurements->find()->where([‘id’ => $ids])->count();

I get the error message " Cannot convert value of type array to string - InvalidArgumentException"

Looking at the link provided, and at your code, and the error message, I assume that $ids is an array?

In which case try: -

$this->loadModel(‘Measurements’);
$total = $this->Measurements->find()->where(['id IN' => $ids])->count();

Untested; but its seems you need to use the IN statement in your query.
https://book.cakephp.org/4/en/orm/query-builder.html#automatically-creating-in-clauses

Great, thank you so much. I guessed it was some stupid detail.