class EntityDeleteHandler in Services Client 7.2
General entity delete handler.
Hierarchy
- class \ServicesClientPlugin implements ServicesClientConfigurableInterface
- class \EventHandler
- class \EntityDeleteHandler
- class \EventHandler
Expanded class hierarchy of EntityDeleteHandler
2 string references to 'EntityDeleteHandler'
- services_client_migrate_hook in ./
services_client.legacy.inc - Migrate old hook with mapping to new system.
- services_client_services_client_event_handler in ./
services_client.plugins.inc - List availalable event handler plugins.
File
- include/
event.inc, line 1042
View source
class EntityDeleteHandler extends EventHandler {
/**
* Execute event and send event to remove endpoint.
*
* @return ServicesClientEventResult
*/
public function execute() {
// Create action result.
$result = new ServicesClientEventResult();
$result
->setHandler($this);
$result->event = $this
->getEvent();
$result->object = NULL;
$result->entity = $this
->getEntity();
$result->entity_type = $result->event->entity_type;
// Allow other modules to react on before request.
module_invoke_all('services_client_before_request', $this, NULL);
$this
->log(ServicesClientLogLevel::INFO, "DELETING; connection : @connection, event : @event, entity_type : @entity_type, entity_id : @entity_id, uuid : @uuid", array(
'@event' => $this->event->name,
'@connection' => $this
->getConnectionId(),
'@entity_type' => $this->event->entity_type,
'@entity_id' => $this
->getEntityId(),
'@uuid' => $this
->getEntity()->uuid,
));
try {
$result->response = $this
->doSync(NULL);
$result->request = $this
->getConnection()
->getRequest();
} catch (ServicesClientConnectionResponseException $e) {
$e
->log();
$result->error_message = $e
->getServicesMessage();
$result->error_code = $e
->getErrorCode();
$result->request = $e->request;
// Determien what error type, by default we assume remote server failed.
$error_type = ServicesClientErrorType::REMOTE_SERVER;
// Logic errors that came from remote site, like can't login
if ($e
->getErrorCode() >= 400 && $e
->getErrorCode() < 500) {
$error_type = ServicesClientErrorType::REMOTE_LOGIC;
}
elseif ($e
->getErrorCode() < 100) {
$error_type = ServicesClientErrorType::NETWORK;
}
// Set error type
$result->error_type = $error_type;
} catch (Exception $e) {
$result->error_message = $e
->getMessage();
$result->error_type = ServicesClientErrorType::UNKNOWN;
}
$this
->logErrorResult($result);
$this
->afterSync(NULL, $result);
// Allow other modules to react on after request.
module_invoke_all('services_client_after_request', $this, NULL, $result);
return $result;
}
/**
* Execute sync action.
*/
protected function doSync($object) {
$id = $this
->getRemoteEntityId();
if (!empty($id)) {
$this
->getConnection()
->delete($this->config['resource'], $id);
return $this
->getConnection()
->getResponse();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityDeleteHandler:: |
protected | function |
Execute sync action. Overrides EventHandler:: |
|
EntityDeleteHandler:: |
public | function |
Execute event and send event to remove endpoint. Overrides EventHandler:: |
|
EventHandler:: |
protected | property | Holds connection to remote server. | |
EventHandler:: |
protected | property | Processed drupal entity in event. | |
EventHandler:: |
protected | property | Initialized plugin classes. | |
EventHandler:: |
protected | property | Stores tags assigned to event. | |
EventHandler:: |
public | function | Add configuration plugin. | |
EventHandler:: |
public | function | Add event tag. | |
EventHandler:: |
protected | function | Allow plugin to react on before sync event. | |
EventHandler:: |
protected | function | Allow plugin to react on before sync event. | 2 |
EventHandler:: |
public | function | Break any edit lock for current event. | |
EventHandler:: |
public | function | Clear current object cache. | |
EventHandler:: |
public | function |
Configuration form. Overrides ServicesClientPlugin:: |
1 |
EventHandler:: |
public | function |
Submit handler; Store plugin configuration. Overrides ServicesClientPlugin:: |
2 |
EventHandler:: |
protected | function | Retrieve printed version of any variable. Should be used for logging. | |
EventHandler:: |
public | function | Enqueue item if should be queue. | |
EventHandler:: |
protected | function | Put current entity to queue. | |
EventHandler:: |
protected | function | Generates a UUID v4 using PHP code. | |
EventHandler:: |
public | function | Retrieve UI base url for event. | |
EventHandler:: |
protected | function | Retrieves event connection to remote site. | |
EventHandler:: |
protected | function | Retrieve remote connection id. | |
EventHandler:: |
protected | function | Retrieve controll data for current entity. | |
EventHandler:: |
protected | function | Retrieve default event configuration. | 1 |
EventHandler:: |
public | function | Retrieve edit lock if exists (other user is editing same event). | |
EventHandler:: |
public | function | Retrieve current event entity. | |
EventHandler:: |
public | function | Retrieve entity ID. | |
EventHandler:: |
public | function | Retrieve event definition. | |
EventHandler:: |
public | function | Retrieve object cached version of event. | |
EventHandler:: |
public | function | Retrieve current object from cache. If not currently in object cache adds object to object cache. | |
EventHandler:: |
public | function | Retrieve existing plugin. | |
EventHandler:: |
protected | function | Retrieve plugin instance by name and configuration. | |
EventHandler:: |
public | function | Retrieve remote entity ID. | 1 |
EventHandler:: |
protected | function | Load remote ID by UUID based on remote UUID configuration. | |
EventHandler:: |
public | function | Get path prefixed with event specific URL. | |
EventHandler:: |
public | function | Check if event has specific tag. | |
EventHandler:: |
public | function | Determine weather event should be fired automatically on drupal object action like node_save or node_delete. | |
EventHandler:: |
public | function | Determine weather object has been changed by editing configuration and not which isn't stored in permanent storage. | |
EventHandler:: |
public | function | Determine wheather entity is matching event conditions. | |
EventHandler:: |
protected | function | Log messages to Drupal watchdog. | |
EventHandler:: |
protected | function | Log error result from services client operation. | |
EventHandler:: |
public | function | Retrieve instance of object initialized with object cache. | |
EventHandler:: |
public | function | Remove existing plugin from configuration. This does is not saved to DB until save() method is called. | |
EventHandler:: |
public | function | Remove tag from event. | |
EventHandler:: |
public | function | Save current event configuration to database. | |
EventHandler:: |
public | function | Set new connection to remote site. | |
EventHandler:: |
public | function | Set entity for current event. | |
EventHandler:: |
public | function | Store current object state to object cache. | |
EventHandler:: |
public | function | Update plugin configuration. This does is not saved to DB until save() method is called. | |
EventHandler:: |
public | function | Return TRUE if this entity shouldn't be send automatically to all connections. | |
EventHandler:: |
public | function |
Constructor. Overrides ServicesClientPlugin:: |
|
ServicesClientPlugin:: |
protected | property | Plugin specific configuration | |
ServicesClientPlugin:: |
protected | property | Event definition | |
ServicesClientPlugin:: |
public | function |
Validate configuration form. Overrides ServicesClientConfigurableInterface:: |
1 |
ServicesClientPlugin:: |
public | function |
Retrieve current plugin configuration. Overrides ServicesClientConfigurableInterface:: |
|
ServicesClientPlugin:: |
public | function |
Set configuration of plugin. Overrides ServicesClientConfigurableInterface:: |