PHP Notice: Undefined property: stdClass::$type in - on line 40