Object of class stdClass could not be converted to int