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


PHP Row::getDestination方法代码示例

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


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

示例1: import

 /**
  * {@inheritdoc}
  */
 public function import(Row $row, array $old_destination_id_values = array())
 {
     $destination = $row->getDestination();
     $langcode = $destination['default_langcode'];
     // Check if the language exists.
     if (ConfigurableLanguage::load($langcode) === NULL) {
         throw new MigrateException("The language '{$langcode}' does not exist on this site.");
     }
     $this->config->set('default_langcode', $destination['default_langcode']);
     $this->config->save();
     return [$this->config->getName()];
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:15,代码来源:DefaultLangcode.php

示例2: import

 /**
  * {@inheritdoc}
  */
 public function import(Row $row, array $old_destination_id_values = array())
 {
     $destination = $row->getDestination();
     $keys = array();
     foreach (array_keys($this->ids) as $id) {
         $keys[$id] = $destination[$id];
         unset($destination[$id]);
     }
     \Drupal::database()->merge($this->table_name)->keys($keys)->fields($destination)->execute();
     $return = array_map(function ($key) use($row) {
         return $row->getDestinationProperty($key);
     }, $keys);
     return $return;
 }
开发者ID:penguinclub,项目名称:penguinweb_drupal8,代码行数:17,代码来源:AclTable.php

示例3: transform

 public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property)
 {
     $entity_type = $row->getDestination()['type'];
     $definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions('node', $entity_type);
     if (isset($definitions[$destination_property])) {
         $vid = $this->configuration['vid'];
         $tid_qry = db_select('taxonomy_term_field_data', 't')->fields('t', array('tid'))->condition('name', $value)->execute();
         $db_row = $tid_qry->fetchAssoc();
         if ($db_row !== FALSE) {
             return $db_row['tid'];
         } else {
             trigger_error("Missing term '{$value}' under vid '{$vid}'", E_USER_WARNING);
             return array();
         }
     }
 }
开发者ID:digitaldonkey,项目名称:donkeymedia_migrate,代码行数:16,代码来源:DonkeymediaTags.php

示例4: updateEntity

 /**
  * Update an entity with the new values from row.
  *
  * @param \Drupal\Core\Entity\EntityInterface $entity
  *   The entity to update.
  * @param \Drupal\migrate\Row $row
  *   The row object to update from.
  */
 protected function updateEntity(EntityInterface $entity, Row $row)
 {
     foreach ($row->getDestination() as $field_name => $values) {
         $field = $entity->{$field_name};
         if ($field instanceof TypedDataInterface) {
             $field->setValue($values);
         }
     }
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:17,代码来源:EntityContentBase.php

示例5: testMultipleDestination

 /**
  * Tests setting/getting multiple destination IDs.
  */
 public function testMultipleDestination()
 {
     $row = new Row($this->testValues, $this->testSourceIds);
     // Set some deep nested values.
     $row->setDestinationProperty('image/alt', 'alt text');
     $row->setDestinationProperty('image/fid', 3);
     $this->assertTrue($row->hasDestinationProperty('image'));
     $this->assertFalse($row->hasDestinationProperty('alt'));
     $this->assertFalse($row->hasDestinationProperty('fid'));
     $destination = $row->getDestination();
     $this->assertEquals('alt text', $destination['image']['alt']);
     $this->assertEquals(3, $destination['image']['fid']);
     $this->assertEquals('alt text', $row->getDestinationProperty('image/alt'));
     $this->assertEquals(3, $row->getDestinationProperty('image/fid'));
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:18,代码来源:RowTest.php

示例6: import

 /**
  * {@inheritdoc}
  */
 public function import(Row $row, array $old_destination_id_values = array())
 {
     $destination = $row->getDestination();
     \Drupal::database()->merge('acl')->key(array('acl_id' => $destination['acl_id']))->fields(array('module' => $destination['module'], 'name' => $destination['name'], 'figure' => $destination['figure']))->execute();
     return [$row->getDestinationProperty('acl_id')];
 }
开发者ID:penguinclub,项目名称:penguinweb_drupal8,代码行数:9,代码来源:AclList.php


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