當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ContentEntityBase::postDelete方法代碼示例

本文整理匯總了PHP中Drupal\Core\Entity\ContentEntityBase::postDelete方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContentEntityBase::postDelete方法的具體用法?PHP ContentEntityBase::postDelete怎麽用?PHP ContentEntityBase::postDelete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Entity\ContentEntityBase的用法示例。


在下文中一共展示了ContentEntityBase::postDelete方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     // See if any of the term's children are about to be become orphans.
     $orphans = array();
     foreach (array_keys($entities) as $tid) {
         if ($children = taxonomy_term_load_children($tid)) {
             foreach ($children as $child) {
                 // If the term has multiple parents, we don't delete it.
                 $parents = taxonomy_term_load_parents($child->id());
                 if (empty($parents)) {
                     $orphans[] = $child->id();
                 }
             }
         }
     }
     // Delete term hierarchy information after looking up orphans but before
     // deleting them so that their children/parent information is consistent.
     $storage->deleteTermHierarchy(array_keys($entities));
     if (!empty($orphans)) {
         entity_delete_multiple('taxonomy_term', $orphans);
     }
 }
開發者ID:Nikola-xiii,項目名稱:d8intranet,代碼行數:26,代碼來源:Term.php

示例2: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     $uids = array_keys($entities);
     \Drupal::service('user.data')->delete(NULL, $uids);
 }
開發者ID:ravindrasingh22,項目名稱:Drupal-8-rc,代碼行數:9,代碼來源:User.php

示例3: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $nodes)
 {
     parent::postDelete($storage, $nodes);
     \Drupal::service('node.grant_storage')->deleteNodeRecords(array_keys($nodes));
 }
開發者ID:brstde,項目名稱:gap1,代碼行數:8,代碼來源:Node.php

示例4: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     if (\Drupal::moduleHandler()->moduleExists('block')) {
         // Make sure there are no active blocks for these feeds.
         $ids = \Drupal::entityQuery('block')->condition('plugin', 'aggregator_feed_block')->condition('settings.feed', array_keys($entities))->execute();
         if ($ids) {
             $block_storage = \Drupal::entityManager()->getStorage('block');
             $block_storage->delete($block_storage->loadMultiple($ids));
         }
     }
 }
開發者ID:papillon-cendre,項目名稱:d8,代碼行數:15,代碼來源:Feed.php

示例5: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     $child_cids = $storage->getChildCids($entities);
     entity_delete_multiple('comment', $child_cids);
     foreach ($entities as $id => $entity) {
         \Drupal::service('comment.statistics')->update($entity);
     }
 }
開發者ID:brstde,項目名稱:gap1,代碼行數:12,代碼來源:Comment.php

示例6: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     // Since we are deleting one or multiple job items here we also need to
     // delete the attached messages.
     $mids = \Drupal::entityQuery('tmgmt_message')->condition('tjiid', array_keys($entities), 'IN')->execute();
     if (!empty($mids)) {
         entity_delete_multiple('tmgmt_message', $mids);
     }
     $trids = \Drupal::entityQuery('tmgmt_remote')->condition('tjiid', array_keys($entities), 'IN')->execute();
     if (!empty($trids)) {
         entity_delete_multiple('tmgmt_remote', $trids);
     }
 }
開發者ID:andrewl,項目名稱:andrewlnet,代碼行數:17,代碼來源:JobItem.php

示例7: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     $ids = \Drupal::entityQuery('tmgmt_local_task_item')->condition('tltid', array_keys($entities), 'IN')->execute();
     if (!empty($ids)) {
         $storage_handler = \Drupal::entityTypeManager()->getStorage('tmgmt_local_task_item');
         $entities = $storage_handler->loadMultiple($ids);
         $storage_handler->delete($entities);
     }
 }
開發者ID:andrewl,項目名稱:andrewlnet,代碼行數:13,代碼來源:LocalTask.php

示例8: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $entities)
 {
     parent::postDelete($storage, $entities);
     static::invalidateBlockPluginCache();
 }
開發者ID:eigentor,項目名稱:tommiblog,代碼行數:8,代碼來源:BlockContent.php

示例9: postDelete

 /**
  * {@inheritdoc}
  */
 public static function postDelete(EntityStorageInterface $storage, array $orders)
 {
     parent::postDelete($storage, $orders);
     // Delete data from the appropriate Ubercart order tables.
     $ids = array_keys($orders);
     $result = \Drupal::entityQuery('uc_order_product')->condition('order_id', $ids, 'IN')->execute();
     if (!empty($result)) {
         entity_delete_multiple('uc_order_product', array_keys($result));
     }
     db_delete('uc_order_comments')->condition('order_id', $ids, 'IN')->execute();
     db_delete('uc_order_admin_comments')->condition('order_id', $ids, 'IN')->execute();
     db_delete('uc_order_log')->condition('order_id', $ids, 'IN')->execute();
     foreach ($orders as $order_id => $order) {
         // Delete line items for the order.
         uc_order_delete_line_item($order_id, TRUE);
         // Log the action in the database.
         \Drupal::logger('uc_order')->notice('Order @order_id deleted by user @uid.', ['@order_id' => $order_id, '@uid' => \Drupal::currentUser()->id()]);
     }
 }
開發者ID:justincletus,項目名稱:webdrupalpro,代碼行數:22,代碼來源:Order.php


注:本文中的Drupal\Core\Entity\ContentEntityBase::postDelete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。