public function deleteContent(ContentInfo $contentInfo) { $contentInfo = $this->internalLoadContentInfo($contentInfo->id); if (!$this->repository->canUser('content', 'remove', $contentInfo)) { throw new UnauthorizedException('content', 'remove', array('contentId' => $contentInfo->id)); } $affectedLocations = []; $this->repository->beginTransaction(); try { // Load Locations first as deleting Content also deletes belonging Locations $spiLocations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($contentInfo->id); $this->persistenceHandler->contentHandler()->deleteContent($contentInfo->id); foreach ($spiLocations as $spiLocation) { $this->persistenceHandler->urlAliasHandler()->locationDeleted($spiLocation->id); $affectedLocations[] = $spiLocation->id; } $this->repository->commit(); } catch (Exception $e) { $this->repository->rollback(); throw $e; } return $affectedLocations; }