-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Invalid field error reported for bigint DBAL type #11073
Comments
Why? As you mentioned yourself, |
What I really wanted to say is that it would be nice to allow usage of |
The same issue after upgrade from
to
Entity:
error:
|
@emodric @dmamchyts it's unclear to me whether you have read and understood #10944 |
Yes, and so far I haven't had issues with performance. |
Ok, so… if you were starting from scratch, you would not be using |
Not really. Isn't |
I wrongly thought it would allow integers larger than 64 bits because you stated:
Now I fail to understand the logic in your first message. Did you mean to write "since we do not need values larger than |
Well, yes, that's true, I meant So, just to be clear, yes, we're using |
If I understand correctly https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#bigint - in 4.0.0 current issue will be fixed? Values retrieved from the database are always converted to PHP's integer type if they are within PHP's integer range or string if they aren't. Otherwise, returns null if no data is present. |
Indeed, I forgot about that. The related PR is doctrine/dbal#6177 Not sure what to do now… I don't think there is an upgrade path for this particular breaking change. I think the right course of action for you is to use Then before migrating to 4.0.0, you change the type to |
Looks like I can ignore minor/patch releases (if no any performance issues). Do you have any ETA about the release 4.0.0? |
I'd say months if not weeks. |
Soon'ish, but it will require you to upgrade to ORM 3 as well. I have the same issue on one of my projects as well and my fear is that this error incentivizes people to change all their Also, a lot of projects have the schema validation in their CI (which is good!) and now this new check (which is absolutely reasonable!) blocks the ORM upgrade unless the schema validation is either disabled completely or all errors have been fixed. In the project where I have this problem, we have twenty-something properties that have the infamous |
I have the same issue with |
Might be cool to have some kind of baseline concept but for that we would first need to come up with identifiers for each and every issue. Or at least for this one, as a start. Then I guess that system could be developed so that it's possible to baseline issues per entity/property/whatever. Might even be call to use PHP attributes to that end. class MyEntity
{
#[SuppressValidationError('invalid_type')]
private float $myDecimal;
} Not saying I will build it, but still, might be cool. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Is this issue being fixed by the way? I have this problem too as well as the other you've already fixed (thanks!) |
Why Doctrine devs did not check PHP_INT_SIZE in Doctrine\DBAL\Types\BigIntType and cast to string for value 4 and cast to int for value 8? :/ |
@vitxd there is #11130 that might be of help @mindaugasvcs I don't think I 100% understand your question, but having an application behave differently based on |
Of course always casting to a 'string' is much nicer when in fact it should be int as 32-bit systems are dead by now. |
Ah sorry, I did misunderstand. What you're suggesting is actually more or less what's going to happen with DBAL 4: doctrine/dbal#6177 |
Anyway, closing as:
|
Bug Report
Summary
I have an entity with a
bigint
primary key, wich has anint
typehint in the entity class. I realize from the error message thatbigint
usesstring
internally, but so far, there was no issues with usingint
typehint, especially, since we do not need values larger than 64bit integers.Current behavior
After upgrading to Doctrine ORM 2.17.1, the above error is shown in logs.
How to reproduce
Expected behavior
No error message is reported.
The text was updated successfully, but these errors were encountered: