Last active
August 29, 2015 14:22
-
-
Save sdaoudi/e4af91e37e7516216b22 to your computer and use it in GitHub Desktop.
eZ Publish 2014.11 - How to delete a content by a contentId
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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