PDOStatement::fetchAll()
already returns an array so you’re just double-nesting the result set for no reason.
In your model::find()
method, change these lines…
while($data = $query->fetchAll(PDO::FETCH_OBJ)){
$d[] = $data;
}
return($d);
to
return $query->fetchAll(PDO::FETCH_OBJ);
You can also remove the model
$d
property (not that you were using it anyway).
1
solved Class query PDO property of non-object