php-activerecord icon indicating copy to clipboard operation
php-activerecord copied to clipboard

index not of right type after row creation

Open CC007 opened this issue 8 years ago • 0 comments

Consider the table foos:

+---+-------+
|id |  foo  |
+---+-------+
|INT|VARCHAR|
+---+-------+

If you then query using find_by_id, the result is as expected: an object (lets say $var) where $var->id is an int and $var->foo is a string

However, when creating a new row:

$var = new Foo;
$var->foo = 'bar';
$var->save();

Then $var->id is a string. I consider this unexpected behaviour and it caused me headaches until I realized that this was the case. I hope this can be fixed soon.

CC007 avatar Sep 13 '17 08:09 CC007