/** * Removes a location from its $locationId (but not its descendants) * Content which looses its main Location will get the first * of its other Locations assigned as the new main Location. * If content has no location left, it's removed from backend * * @param mixed $locationId */ public function delete($locationId) { $location = $this->load($locationId); $this->backend->delete('Content\\Location', $locationId); $remainingLocations = $this->backend->find('Content\\Location', array('contentId' => $location->contentId)); // If no remaining location for associated content, remove the content as well // Else, update the mainLocationId if needed if (empty($remainingLocations)) { try { $this->handler->contentHandler()->deleteContent($location->contentId); } catch (NotFound $e) { } } else { $this->backend->update('Content\\ContentInfo', $location->contentId, array('mainLocationId' => $remainingLocations[0]->id)); } }
/** * @see eZ\Publish\SPI\Persistence\Content\Location\Trash\Handler */ public function deleteTrashItem($trashedId) { $vo = $this->loadTrashItem($trashedId); $this->handler->contentHandler()->deleteContent($vo->contentId); $this->backend->delete('Content\\Location\\Trashed', $trashedId); }