You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Connect API: fetch() treating integer variables as strings

Accepted answer
edited Sep 1, 2016 5:59AM in Integrations and APIs 5 comments


I keep having the repeated problem of an object's fetch method not treating integer variables as integers.

For example:

RNCPHP\ServiceCategory::fetch(1)  --->Works perfectly fine

RNCPHP\ServiceCategory::fetch($incident->Category->ID)  --->Tries to search as though i passed in a string

RNCPHP\ServiceCategory::fetch(intval($incident->Category->ID)) --->For some reason the call to intval in this situation fails and it tries to fetch ID 0

var_dump($incident->Category->ID)   --->prints out int(82)

var_dump(intval($incident->Category->ID))   --->prints out int(82)


My workaround to the above issue ended up being this...

$catArray = RNCPHP\ServiceCategory::find("ID = ".((string)$incident->Category->ID));   --->Works fine

Howdy, Stranger!

Log In

To view full details, sign in.


Don't have an account? Click here to get started!