Query Builder parsing to Json


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->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');

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());


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.