当前位置: 首页>>代码示例>>PHP>>正文


PHP ContentEntityBase::postSave方法代码示例

本文整理汇总了PHP中Drupal\Core\Entity\ContentEntityBase::postSave方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentEntityBase::postSave方法的具体用法?PHP ContentEntityBase::postSave怎么用?PHP ContentEntityBase::postSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Entity\ContentEntityBase的用法示例。


在下文中一共展示了ContentEntityBase::postSave方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // Only change the parents if a value is set, keep the existing values if
     // not.
     if (isset($this->parent->target_id)) {
         $storage->deleteTermHierarchy(array($this->id()));
         $storage->updateTermHierarchy($this);
     }
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:13,代码来源:Term.php

示例2: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // If no order number has been set explicitly, set it to the order id.
     if (!$this->getOrderNumber()) {
         $this->setOrderNumber($this->id());
         $this->save();
     }
     // Ensure there's a back-reference on each line item.
     foreach ($this->getLineItems() as $line_item) {
         if ($line_item->order_id->isEmpty()) {
             $line_item->order_id = $this->id();
             $line_item->save();
         }
     }
 }
开发者ID:marmouset,项目名称:drupal,代码行数:19,代码来源:Order.php

示例3: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // Update the node access table for this node, but only if it is the
     // default revision. There's no need to delete existing records if the node
     // is new.
     if ($this->isDefaultRevision()) {
         \Drupal::entityManager()->getAccessControlHandler('node')->writeGrants($this, $update);
     }
     // Reindex the node when it is updated. The node is automatically indexed
     // when it is added, simply by being added to the node table.
     if ($update) {
         node_reindex_node_search($this->id());
     }
 }
开发者ID:brstde,项目名称:gap1,代码行数:18,代码来源:Node.php

示例4: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // Copy values for shared fields to existing user.
     if (\Drupal::config('simplenews.settings')->get('subscriber.sync_fields') && ($user = $this->getUser())) {
         static::$syncing = TRUE;
         foreach ($this->getUserSharedFields($user) as $field_name) {
             $user->set($field_name, $this->get($field_name)->getValue());
         }
         $user->save();
         static::$syncing = FALSE;
     }
 }
开发者ID:aritnath1990,项目名称:simplenewslatest,代码行数:16,代码来源:Subscriber.php

示例5: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     $this->releaseThreadLock();
     // Update the {comment_entity_statistics} table prior to executing the hook.
     \Drupal::service('comment.statistics')->update($this);
 }
开发者ID:brstde,项目名称:gap1,代码行数:10,代码来源:Comment.php

示例6: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // Entity::postSave() calls Entity::invalidateTagsOnSave(), which only
     // handles the regular cases. The Shortcut entity has one special case: a
     // newly created shortcut is *also* added to a shortcut set, so we must
     // invalidate the associated shortcut set's cache tag.
     if (!$update) {
         Cache::invalidateTags($this->getCacheTag());
     }
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:14,代码来源:Shortcut.php

示例7: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // Always invalidate the cache tag for the commented entity.
     if ($commented_entity = $this->getCommentedEntity()) {
         Cache::invalidateTags($commented_entity->getCacheTagsToInvalidate());
     }
     $this->releaseThreadLock();
     // Update the {comment_entity_statistics} table prior to executing the hook.
     \Drupal::service('comment.statistics')->update($this);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:14,代码来源:Comment.php

示例8: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // Reindex the support_ticket when it is updated. The support_ticket is
     // automatically indexed when it is added, simply by being added to the
     // support_ticket table.
     if ($update) {
         // @todo
         // support_ticket_reindex_support_ticket_search($this->id());
     }
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:14,代码来源:SupportTicket.php

示例9: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // Entity::postSave() calls Entity::invalidateTagsOnSave(), which only
     // handles the regular cases. The Item entity has one special case: a newly
     // created Item is *also* associated with a Feed, so we must invalidate the
     // associated Feed's cache tag.
     if (!$update) {
         Cache::invalidateTags($this->getCacheTagsToInvalidate());
     }
 }
开发者ID:318io,项目名称:318-io,代码行数:14,代码来源:Item.php

示例10: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // If this is not a refresh token then create one.
     if (!$this->isRefreshToken()) {
         $this->addRefreshToken();
     }
     // If there is an access token for those conditions (resource + user) then
     // delete it.
     if (!$this->isNew() && $this->isDuplicated()) {
         $this->deleteDuplicates();
     }
 }
开发者ID:mosswoodcreative,项目名称:d8-api-test,代码行数:16,代码来源:AccessToken.php

示例11: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     foreach ($this->identities_unsaved as $k => $identity) {
         $registrant = Registrant::create(['registration' => $this])->setIdentity($identity);
         $registrant->save();
         unset($this->identities_unsaved[$k]);
     }
     $trigger_id = $update ? 'entity:registration:update' : 'entity:registration:new';
     \Drupal::service('rng.event_manager')->getMeta($this->getEvent())->trigger($trigger_id, ['registrations' => [$this]]);
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:14,代码来源:Registration.php

示例12: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     /** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
     $menu_link_manager = \Drupal::service('plugin.manager.menu.link');
     // The menu link can just be updated if there is already an menu link entry
     // on both entity and menu link plugin level.
     $definition = $this->getPluginDefinition();
     // Even when $update is FALSE, for top level links it is possible the link
     // already is in the storage because of the getPluginDefinition() call
     // above, see https://www.drupal.org/node/2605684#comment-10515450 for the
     // call chain. Because of this the $update flag is ignored and only the
     // existence of the definition (equals to being in the tree storage) is
     // checked.
     if ($menu_link_manager->getDefinition($this->getPluginId(), FALSE)) {
         // When the entity is saved via a plugin instance, we should not call
         // the menu tree manager to update the definition a second time.
         if (!$this->insidePlugin) {
             $menu_link_manager->updateDefinition($this->getPluginId(), $definition, FALSE);
         }
     } else {
         $menu_link_manager->addDefinition($this->getPluginId(), $definition);
     }
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:27,代码来源:MenuLinkContent.php

示例13: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     /** @var \Drupal\profile\ProfileStorage $storage */
     parent::postSave($storage, $update);
     // Check if this profile is, or became the default.
     if ($this->isDefault()) {
         /** @var \Drupal\profile\Entity\ProfileInterface[] $profiles */
         $profiles = $storage->loadMultipleByUser($this->getOwner(), $this->getType());
         // Ensure that all other profiles are set to not default.
         foreach ($profiles as $profile) {
             if ($profile->id() != $this->id()) {
                 $profile->setDefault(FALSE);
                 $profile->save();
             }
         }
     }
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:20,代码来源:Profile.php

示例14: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     static::invalidateBlockPluginCache();
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:8,代码来源:BlockContent.php

示例15: postSave

 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     foreach ($this->products as $product) {
         \Drupal::moduleHandler()->alter('uc_order_product', $product, $this);
         uc_order_product_save($this->id(), $product);
     }
     // Record a log entry if the order status has changed.
     if ($update && $this->getStatusId() != $this->original->getStatusId()) {
         $this->logChanges([(string) t('Order status') => ['old' => $this->original->getStatus()->getName(), 'new' => $this->getStatus()->getName()]]);
         // rules_invoke_event('uc_order_status_update', $this->original, $this);
     }
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:16,代码来源:Order.php


注:本文中的Drupal\Core\Entity\ContentEntityBase::postSave方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。