本文整理汇总了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);
}
}
示例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);
}
示例3: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $nodes)
{
parent::postDelete($storage, $nodes);
\Drupal::service('node.grant_storage')->deleteNodeRecords(array_keys($nodes));
}
示例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));
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例8: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
static::invalidateBlockPluginCache();
}
示例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()]);
}
}