backdrop-contrib / search_api

Provides a generic API for modules offering search capabilities
GNU General Public License v2.0
0 stars 6 forks source link

Undefined property: stdClass::$language and SearchApiViewsCache::$table #67

Closed kswan closed 2 months ago

kswan commented 3 months ago

I am getting the following error messages when using the Search API Views module.

Notice: Undefined property: stdClass::$language in SearchApiViewsCache->get_cache_key() (line 100 of /modules/search_api/contrib/search_api_views/includes/plugin_cache.inc).

Notice: Undefined property: SearchApiViewsCache::$table in SearchApiViewsCache->cache_set() (line 49 of /modules/search_api/contrib/search_api_views/includes/plugin_cache.inc).

Notice: Undefined property: SearchApiViewsCache::$table in SearchApiViewsCache->cache_get() (line 65 of /modules/search_api/contrib/search_api_views/includes/plugin_cache.inc).

I'll submit a PR.

argiepiano commented 3 months ago

Did a quick check. The PR seems correct.

views_plugin_cache::$table was replaced in Backdrop with views_plugin_cache::$bin. And of course langcode is used in Backdrop rather than language.

While not necessary, I'd suggest using cache() which retrieves a cache object, which is more Backdrop-y than cache_set(). See the use of this in views_plugin_cache::cache_set()

To clarify, I haven't tested the PR, just reviewed the code.

laryn commented 2 months ago

Thanks @kswan -- looks good.

@argiepiano I would have accepted your additional suggestion as well, but I'm okay with this as is, too. 😄