Skip to content
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

Idea: Check if QueryBuilder ->where()->setParameter() is set to Types::SIMPLE_ARRAY for array columns #432

Open
ThomasLandauer opened this issue Mar 9, 2023 · 0 comments

Comments

@ThomasLandauer
Copy link
Contributor

When a field is defined as simple_array:

#[ORM\Column(type: Types::SIMPLE_ARRAY, length: 255, nullable: true)]
private array $foo = [];

... then using it in a Query Builder like this

$queryBuilder->where('a.foo = :array')->setParameter('array', $array, Types::SIMPLE_ARRAY);

... only works, if the third argument to setParameter() ($type) is given.
If not, I'm getting this Doctrine\DBAL\Exception\ SyntaxErrorException:

An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 near ",": syntax error

Would it possible for PHPStan to check for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant