Skip to content

Commit 2fd3f65

Browse files
committed
add support for variadic functions on doctrine querybuilder selects Haehnchen#357
1 parent fd37291 commit 2fd3f65

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/fr/adrienbrault/idea/symfony2plugin/doctrine/querybuilder/QueryBuilderMethodReferenceParser.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,16 @@ private void collectSelects(QueryBuilderScopeContext qb, MethodReference methodR
120120
}
121121

122122
// $qb->select('foo')
123-
PsiElement psiElement = PsiElementUtils.getMethodParameterPsiElementAt(methodReference, 0);
124-
String literalValue = PhpElementsUtil.getStringValue(psiElement);
125-
if(literalValue != null) {
126-
qb.addSelect(literalValue);
127-
return;
123+
// $qb->select('foo', 'foo1')
124+
for(PsiElement parameter: methodReference.getParameters()) {
125+
String literalValue = PhpElementsUtil.getStringValue(parameter);
126+
if(literalValue != null) {
127+
qb.addSelect(literalValue);
128+
}
128129
}
129130

130131
// $qb->select(array('foo', 'bar', 'accessoryDetail'))
132+
PsiElement psiElement = PsiElementUtils.getMethodParameterPsiElementAt(methodReference, 0);
131133
if(psiElement instanceof ArrayCreationExpression) {
132134
for(PsiElement arrayValue: PsiElementUtils.getChildrenOfTypeAsList(psiElement, PlatformPatterns.psiElement(PhpElementTypes.ARRAY_VALUE))) {
133135
if(arrayValue.getChildren().length == 1) {

0 commit comments

Comments
 (0)