public function onBeforeAlbumDelete(OW_Event $event) { $params = $event->getParams(); if (empty($params['id']) || ($album = $this->albumService->findAlbumById($params['id'])) === NULL) { return; } foreach ($this->photoService->findDistinctPhotoUploadKeyByAlbumId($album->id) as $photo) { $this->photoService->feedDeleteItem('photo_comments', $photo->id); $this->photoService->feedDeleteItem('multiple_photo_upload', $photo->uploadKey); } PHOTO_BOL_PhotoAlbumCoverDao::getInstance()->deleteCoverByAlbumId($album->id); PHOTO_BOL_SearchService::getInstance()->deleteSearchItem(PHOTO_BOL_SearchService::ENTITY_TYPE_ALBUM, $album->id); }