Undefined variable in custom default.php and query doesn't work

Where are you getting this notice? We have to synchronize all items to load objects from the database instead of associative arrays.