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


PHP EntityInterface::toArray方法代码示例

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


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

示例1: toArray

 /**
  * {@inheritdoc}
  */
 public function toArray()
 {
     if (!isset($this->entity)) {
         throw new MissingDataException('Unable to get property values as no entity has been provided.');
     }
     return $this->entity->toArray();
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:EntityAdapter.php

示例2: getFormSubmitActionForNewTranslation

 /**
  * Returns the form action value when submitting a new translation.
  *
  * @param \Drupal\Core\Entity\EntityInterface $entity
  *   The entity being tested.
  * @param string $langcode
  *   Language code for the form.
  *
  * @return string
  *   Name of the button to hit.
  */
 protected function getFormSubmitActionForNewTranslation(EntityInterface $entity, $langcode)
 {
     $entity->addTranslation($langcode, $entity->toArray());
     return $this->getFormSubmitAction($entity, $langcode);
 }
开发者ID:ravindrasingh22,项目名称:Drupal-8-rc,代码行数:16,代码来源:ContentTranslationUITestBase.php

示例3: mapToStorageRecord

 /**
  * Maps from an entity object to the storage record.
  *
  * @param \Drupal\Core\Entity\EntityInterface $entity
  *   The entity object.
  *
  * @return array
  *   The record to store.
  */
 protected function mapToStorageRecord(EntityInterface $entity)
 {
     return $entity->toArray();
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:13,代码来源:ConfigEntityStorage.php

示例4: doSave

 /**
  * {@inheritdoc}
  */
 protected function doSave($id, EntityInterface $entity)
 {
     $is_new = $entity->isNew();
     // Save the entity data in the key value store.
     $this->keyValueStore->set($entity->id(), $entity->toArray());
     // If this is a rename, delete the original entity.
     if ($this->has($id, $entity) && $id !== $entity->id()) {
         $this->keyValueStore->delete($id);
     }
     return $is_new ? SAVED_NEW : SAVED_UPDATED;
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:14,代码来源:KeyValueEntityStorage.php

示例5: doSave

 /**
  * {@inheritdoc}
  */
 protected function doSave($id, EntityInterface $entity)
 {
     $is_new = $entity->isNew();
     $prefix = $this->getConfigPrefix();
     if ($id !== $entity->id()) {
         // Renaming a config object needs to cater for:
         // - Storage needs to access the original object.
         // - The object needs to be renamed/copied in ConfigFactory and reloaded.
         // - All instances of the object need to be renamed.
         $config = $this->configFactory->rename($prefix . $id, $prefix . $entity->id());
     } else {
         $config = $this->configFactory->get($prefix . $id);
     }
     // Retrieve the desired properties and set them in config.
     foreach ($entity->toArray() as $key => $value) {
         $config->set($key, $value);
     }
     $config->save();
     return $is_new ? SAVED_NEW : SAVED_UPDATED;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:23,代码来源:ConfigEntityStorage.php


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