Makes sure $options['wheres'] is initialized as an array.
Join with entities table only if needed.