/** * send updated event. * * @param $entity * @param $eventName * @param $version */ public function dispatchEvent($entity, $eventName, $version) { $this->eventHelper->dispatchEvent($version, $entity, $eventName, $this->resourceResolver, $this->dispatcher); }
/** * Deletes an element of the collection. * * @param Request $request * @param string $id * @ApiDoc( * resource = true, * statusCodes = { * 204 = "Returned when successful", * 401 = "Returned when the User is not authorized to use this method", * 404 = "Returned when the element not found", * } * ) * * @return Response * * @throws NotFoundHttpException * @throws \InvalidArgumentException */ public function deleteAction(Request $request, $id) { $resource = $this->getResource($request); $resource->isGranted(['DELETE'], true); $object = $this->findOrThrowNotFound($resource, $id); $eventHelper = new EventHelper(); $eventHelper->dispatchEvent($this->getApiVersion(), $object, Events::PRE_DELETE, $this->get('api.resource_collection'), $this->get('event_dispatcher')); return $this->getResponse(null, 204); }