backdrop-contrib / search_api

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

Fixes PHP error when trying to delete an index #4

Closed earlyburg closed 4 years ago

earlyburg commented 4 years ago

Error: Call to undefined method SearchApiIndex::hasStatus() in search_api_admin_confirm() (line 2344 of /modules/search_api/search_api.admin.inc).

D7 Entity object had a method hasStatus() and backdrop core entity module no longer contains this method but we still need it.

Source: https://git.drupalcode.org/project/entity/-/blob/7.x-1.x/includes/entity.inc line 83

earlyburg commented 4 years ago

I should have clarified that definitions like ENTITY_CUSTOM were originally defined in the D7 contrib entity module in entity.module, but as these definitions are specific to exportable entities I am proposing these definitions go in the entity_plus module because that's where our exportable entity object is defined 'EntityPlusControllerExportable'. I am not really sure of a better way to handle this issue?

earlyburg commented 4 years ago

I was working on SearchApiPages and I see what you are referring to. The status like ENTITY_CUSTOM is meaningless when applied to core entity. I still feel we need a solution to this but I am not sure what is yet

docwilmot commented 4 years ago

That line of code is checking if the Entity has a status of ENTITY_OVERRIDDEN which it will never have because the Search API entities are stored in the database, not config, so it should be safe to just delete that conditional code and keep the bit in the else block.