You are here

protected function SearchApiServer::ensureProxy in Search API 7

Helper method for ensuring the proxy object is set up.

16 calls to SearchApiServer::ensureProxy()
SearchApiServer::addIndex in includes/server_entity.inc
Adds a new index to this server.
SearchApiServer::configurationForm in includes/server_entity.inc
Form constructor for the server configuration form.
SearchApiServer::configurationFormSubmit in includes/server_entity.inc
Submit callback for the form returned by configurationForm().
SearchApiServer::configurationFormValidate in includes/server_entity.inc
Validation callback for the form returned by configurationForm().
SearchApiServer::deleteItems in includes/server_entity.inc
Deletes indexed items from this server.

... See full list

File

includes/server_entity.inc, line 127
Contains SearchApiServer.

Class

SearchApiServer
Class representing a search server.

Code

protected function ensureProxy() {
  if (!isset($this->proxy)) {
    $class = search_api_get_service_info($this->class);
    if ($class && class_exists($class['class'])) {
      if (empty($this->options)) {

        // We always have to provide the options.
        $this->options = array();
      }
      $this->proxy = new $class['class']($this);
    }
    if (!$this->proxy instanceof SearchApiServiceInterface) {
      throw new SearchApiException(t('Search server with machine name @name specifies illegal service class @class.', array(
        '@name' => $this->machine_name,
        '@class' => $this->class,
      )));
    }
  }
}