You are here

function deploy_services_client_delete_entity_from_endpoint in Deploy Services Client 7

Deletes an entity from a Deployment endpoint.

The endpoint is first contacted to see if the entity exists there. If so, only then is an actual DELETE request made.

Parameters

EntityMetadataWrapper $entity: The entity object to delete. Construct this by calling entity_metadata_wrapper() on a normal Drupal entity.

DeployEndpoint $endpoint: The endpoint object (as returned by deploy_endpoint_load()) representing the Deployment endpoint on which a request will be made to delete the entity.

Return value

TRUE if the entity was deleted on the endpoint, or FALSE if it did not exist on the endpoint (and therefore was not deleted).

Throws

DeployAuthenticationException

DeployServiceException

1 string reference to 'deploy_services_client_delete_entity_from_endpoint'
deploy_services_client_delete_entity_from_plan_endpoints in ./deploy_services_client.module
Deletes an entity from endpoints associated with a Deployment plan.

File

./deploy_services_client.module, line 50
Provides a Services client which communicates with Deployment endpoints.

Code

function deploy_services_client_delete_entity_from_endpoint(EntityMetadataWrapper $entity, DeployEndpoint $endpoint) {
  $success = FALSE;
  $client = new DeployServicesClient($endpoint);
  $client
    ->login();
  if ($client
    ->get($entity)) {

    // @todo: If the delete method can be changed to have a return value, we
    //   should return that, rather than assuming the deletion was always
    //   successful.
    $client
      ->delete($entity);
    $success = TRUE;
  }
  $client
    ->logout();
  return $success;
}