Skip to content

Instantly share code, notes, and snippets.

@sdaoudi
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdaoudi/e4af91e37e7516216b22 to your computer and use it in GitHub Desktop.
Save sdaoudi/e4af91e37e7516216b22 to your computer and use it in GitHub Desktop.
eZ Publish 2014.11 - How to delete a content by a contentId
$contentId = 127;
$repository = $this->getRepository();
$repository->sudo(
function(Repository $repository) use( $contentId ) {
$contentService = $repository->getContentService();
$contentToDelete = $contentService->loadContent($contentId);
$contentService->deleteContent($contentToDelete->contentInfo);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment