Implemented toggle for articles between i18n/monolingual
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / data / article / content / ArticleContentAction.class.php
index 8afdf4195e1e0d70412ac5f179027fa2364ea1c7..f2afd3735b4a7acf36268a9383065113e03a7fc9 100644 (file)
@@ -1,12 +1,15 @@
 <?php
 namespace wcf\data\article\content;
 use wcf\data\AbstractDatabaseObjectAction;
+use wcf\system\comment\CommentHandler;
+use wcf\system\search\SearchIndexManager;
+use wcf\system\tagging\TagEngine;
 
 /**
  * Executes article content related actions.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2016 WoltLab GmbH
+ * @copyright  2001-2017 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    WoltLabSuite\Core\Data\Article\Content
  * @since      3.0
@@ -19,4 +22,21 @@ class ArticleContentAction extends AbstractDatabaseObjectAction {
         * @inheritDoc
         */
        protected $className = ArticleContentEditor::class;
+       
+       /**
+        * @inheritDoc
+        */
+       public function delete() {
+               $articleContentIDs = [];
+               foreach ($this->getObjects() as $contentEditor) {
+                       $articleContentIDs[] = $contentEditor->getDecoratedObject()->articleContentID;
+               }
+               
+               // delete comments
+               CommentHandler::getInstance()->deleteObjects('com.woltlab.wcf.articleComment', $articleContentIDs);
+               // delete tag to object entries
+               TagEngine::getInstance()->deleteObjects('com.woltlab.wcf.article', $articleContentIDs);
+               // delete entry from search index
+               SearchIndexManager::getInstance()->delete('com.woltlab.wcf.article', $articleContentIDs);
+       }
 }