-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Orm querybuilder set parameters to collection v2 #346
base: main
Are you sure you want to change the base?
[WIP] Orm querybuilder set parameters to collection v2 #346
Conversation
…ection for the setParameters ORM QueryBuilder method
…ters if the variable is used in a ORM QueryBuilder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @marcelthole.
Thought I could chime in and comment on your code a bit.
$arrayValueType = $this->nodeTypeResolver->getType($value->value); | ||
if (! $arrayValueType instanceof ObjectType || ! $arrayValueType->isInstanceOf( | ||
'Doctrine\\ORM\\Query\\Parameter' | ||
)->yes()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
$arrayValueType->isInstanceOf('Doctrine\\ORM\\Query\\Parameter')->no()
return null; | ||
} | ||
|
||
if (! $varType->isInstanceOf('Doctrine\\ORM\\QueryBuilder')->yes()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here:
$varType->isInstanceOf('Doctrine\\ORM\\QueryBuilder')->no()
&& $stmt->expr->name->name === 'setParameters' | ||
) { | ||
$varType = $this->nodeTypeResolver->getType($stmt->expr->var); | ||
if (! $varType->isInstanceOf('Doctrine\\ORM\\QueryBuilder')->yes()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of not yes
you could just use no
so
! $varType->isInstanceOf('Doctrine\\ORM\\QueryBuilder')->yes()
can be changed to:
$varType->isInstanceOf('Doctrine\\ORM\\QueryBuilder')->no()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall i would say the same but the varType as also the type MAYBE
- And in that cases i do not want to modify the values. But i will try to test this also with an fixture
@@ -0,0 +1,27 @@ | |||
<?php | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like other PR, please add namespace if possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will rebase this PR and apply all the fixes after the other one is done if this is fine for you
@@ -0,0 +1,27 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use underscored fixture file name instead of dash
foreach ($variables as $variable) { | ||
$this->iterateThroughStmts($node->getStmts(), $variable); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verify to return null if no change
Additional checks to #326