First, we know that depending on the number of columns in a query, you can increase response time.
In Doctrine I call the following repository, which has a relationship and which brings all the columns of both entities.
public function index()
{
$this->alunos = $this->model->getRepository()->findAll();
}
But thinking about the statement I gave earlier, does the return of this repository take longer than if it were an entity without a relationship?
And another question?
Can I select the columns I want to return from this repository? For example, the above repository returns:
id (entidade aluno)
nome (entidade aluno)
id_turma (entidade turma)
But I would like it to return only the student's name.Type like this:
public function index()
{
$this->alunos = $this->model->getRepository()->findAll("nome");
// ou assim pra pegar mais de um campo
$this->alunos2 = $this->model->getRepository()->findAll("nome, dtNascimento");
}
I know it does not work like that, just to give an example.