I´m trying to do a join in other tables with builder in codeigniter 4.
When I use: $model->find(id) they return an object with the fields, so in view i can direct print with $return->fieldname;
but when I use $builder, I get an array with 0 index and an object inside this array. I want a return like i get from the $model->find();
code:
model:
public function efindOne($id)
{
$builder = $this->db->table('equipe');
$builder->select('*');
$builder->where('equipe.idEf =', $id);
$builder->join('fornecedores', 'fornecedores.idFo = equipe.idFo');
$builder->join('areas', 'areas.idAr = equipe.idAr');
$builder->join('edicao', 'equipe.idEf = edicao.idEf');
//$builder->limit(1);
return $builder->get()->getResultObject();
}
controller:
$equipe= $modelEquipe->efindOne($verId);
result:
When I do:
$equipe= $modelEquipe->find($verId);
i get:
as expected… I already try to limit the result, try to convert array to object, I can´t understand what I’m doing wrong