DDC-249: QueryBuilder documentation states that select() takes an array, but expects strings #307

Open
opened 2026-01-22 12:34:05 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Jan 12, 2010).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user shurakai:

If you try to execute something like

$qb->select(array('u', 'a'))
->from('Entities\User', 'u')
->leftJoin('Entities\Address', 'a')
->where('u.age = 23');

which should be correct if one takes a look at the third example here: http://www.doctrine-project.org/documentation/manual/2_0/en/query-builder#the-querybuilder:working-with-querybuilder:helper-methods

then one will recieve an exception to be thrown, because the ORM\QueryBuilder::select() method makes an internal call for get_func_args() and therefore will pass an array within an array to the ORM\Query\Base class.

In fact, I propose to change the internal of the select() method and check whether an array has been passed and if yes, do not call get_func_args().

By the way, I think that arrays should be supported because it's much easier to dynamically pass an array as an argument than several strings.

Regards
Christian

Originally created by @doctrinebot on GitHub (Jan 12, 2010). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user shurakai: If you try to execute something like $qb->select(array('u', 'a')) ->from('Entities\User', 'u') ->leftJoin('Entities\Address', 'a') ->where('u.age = 23'); which should be correct if one takes a look at the third example here: http://www.doctrine-project.org/documentation/manual/2_0/en/query-builder#the-querybuilder:working-with-querybuilder:helper-methods then one will recieve an exception to be thrown, because the ORM\QueryBuilder::select() method makes an internal call for get_func_args() and therefore will pass an array within an array to the ORM\Query\Base class. In fact, I propose to change the internal of the select() method and check whether an array has been passed and if yes, do not call get_func_args(). By the way, I think that arrays should be supported because it's much easier to dynamically pass an array as an argument than several strings. Regards Christian
admin added the Bug label 2026-01-22 12:34:05 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#307