using observer_typing i am able to convert my variables to their scalar counterparts. However, I am not able to convert my primary key, an auto increment number to integer, after some tracking , apparently observer typing would skip if it's part of the primary key.
after hunting down the code it "fails" here:
line: 81 in observer\typing.php
if (empty($settings) || in_array($p, $instance->primary_key()))
For now I can extend the constructor and do the cast manually
PS: I can't use the code tag? clicking the code button doesn't do anything?
By design the primary key cannot be changed once set (to ensure there can only be one instance of a db row). As the primary key is set before the observer gets to force typing, the observer can't change the primary key's type anymore. Which is why the code skips it. We decided this was an acceptable limitation for 1.0, I may revisit that decision later but it's not on the top of my list.
I guess that semantically makes sense
oh, caching $instance->primary_key() would optimize it better considering it's in the loop and called in multiple times