-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Connection::insert data inference does not use indicated Types #561
Comments
@hemberger could you look into that one? |
Sure, I'll look into this today. |
Here's my test setup: CREATE TABLE testing (
id INT PRIMARY KEY AUTO_INCREMENT,
my_data JSON NOT NULL,
my_bool BOOLEAN NOT NULL
); $db->insert(
'testing',
[
'my_bool' => true,
'my_data' => [1, 2, 3],
],
[
'my_bool' => Types::BOOLEAN,
'my_data' => Types::JSON,
],
); And my results:
Some things to note:
@staabm Assuming you eventually want more complex type converters to be supported, do you have any opinions about how to proceed with this? |
Doctrine types have been requested before #278 I think we could just have a separate class which maps the doctrine type constant-types to phpstan types. Just a guess: Maybe we could get some inspiration from phpstan-doctrine doctrine relfection could utilize it. I don't think we should plug it directly into SchemaReflection or QueryReflection We could also add a rule which validates that the used doctrine type is compatible with the underlying schema column type - if this sounds useful for doctrine users. |
When calling
Connection::insert()
with specific types, phpstan-dba does not use them.Also it's strange that
someBool
expect a string when the column isTINYINT(1) UNSIGNED
The text was updated successfully, but these errors were encountered: