public function EntityDelete::processRequest in Services 9.0.x
Same name and namespace in other branches
- 8.4 src/Plugin/ServiceDefinition/EntityDelete.php \Drupal\services\Plugin\ServiceDefinition\EntityDelete::processRequest()
Processes the request and returns an array of data as appropriate.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request object.
\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match object.
\Symfony\Component\Serializer\SerializerInterface $serializer: The serializer. Some methods might require the plugin to leverage the serializer after extracting the request contents.
Return value
array The response.
Throws
\Symfony\Component\HttpKernel\Exception\HttpException
Overrides ServiceDefinitionInterface::processRequest
File
- src/
Plugin/ ServiceDefinition/ EntityDelete.php, line 33
Class
- EntityDelete
- Plugin annotation @ServiceDefinition( id = "entity_delete", methods = { "DELETE" }, translatable = true, deriver = "\Drupal\services\Plugin\Deriver\EntityDelete" )
Namespace
Drupal\services\Plugin\ServiceDefinitionCode
public function processRequest(Request $request, RouteMatchInterface $route_match, SerializerInterface $serializer) {
/* @var $entity \Drupal\Core\Entity\EntityInterface */
$entity = $this
->getContextValue($this
->getDerivativeId());
$entity
->delete();
}