Query Builder parsing to Json

Hi

My problem is with Query Builder. There a two tables called "Company" and "orders". I want to list all orders, and inside each order I want to see data about relative Company.

 $builder->columns(['object.*','company.*']);
    $builder->addFrom("ReadyApp\Api\Models\Order","object");
     $builder->innerJoin('ReadyApp\Api\Models\Company', 'company.id = object.company_id','company');
    $builder->where('object.client_id = :client_id:',['client_id'=>$id]);
     $builder->orderBy('object.id DESC');
     $builder->groupBy('object.id');

The problem is my json returns a private atributes (columns) without use Getter and Setter passwords. Inside Company table, has a password column, I don't want to show this password column, but my JSON shows all values from table. thanks.

echo json_encode($builder->getQuery()->execute()->toArray());



10.6k

I believe getters and setters and private variables only work if you're using the ORM... https://docs.phalconphp.com/en/latest/reference/models.html

What happens if you don't call toArray() at the end of your echo? I know that when using the ORM, I don't have to call toArray() to ge the desired results.