Added typecast database types into php types

#2211