yiisoft/yii2 — pull request #4586 by docsolver (2014-08-04 09:34:15+00:00)
Title: More sophisticated type determination for integers

The method `getColumnPhpType()` determines the appropriate PHP type for variables, based on the type of their database columns.

The issue I'm having is that all my unsigned integer columns are converted to strings. Presumably this functionality is provided because an unsigned integer in the database exceeds the maximum integer size in a 32-bit PHP system. *(PHP does not have a separate type for unsigned integers. Thus it can only store unsigned numbers half as large as a MySQL database using the same amount of bytes.)*

Since most websites are hosted on Linux (and development is increasingly done using Vagrant boxes, even on Windows), and since servers are overwhelmingly 64-bits already, I feel that the mandatory casting to string of unsigned integers is too restrictive. Moreover, it causes problems further down the road with attributes becoming dirty unexpectedly.

That's why I propose this change: it takes into account the max int size of the PHP environment to determine if casting to string is truly necessary. I also added awareness of the `bigint`-datatype, since their signed version can be safely stored as an integer in a 64-bits PHP system.