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


PHP Row::setSourceProperty方法代码示例

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


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

示例1: prepareRow

 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $uid = $row->getSourceProperty('uid');
     // field_real_name
     $result = $this->getDatabase()->query('
   SELECT
     fld.field_real_name_value
   FROM
     {dcf_field_data_field_real_name} fld
   WHERE
     fld.entity_id = :uid
 ', array(':uid' => $uid));
     foreach ($result as $record) {
         $row->setSourceProperty('field_real_name', $record->field_real_name_value);
     }
     // field_availability
     $result = $this->getDatabase()->query('
   SELECT
     fld.field_availability_value
   FROM
     {dcf_field_data_field_availability} fld
   WHERE
     fld.entity_id = :uid
 ', array(':uid' => $uid));
     foreach ($result as $record) {
         $row->setSourceProperty('field_availability', $record->field_availability_value);
     }
     return parent::prepareRow($row);
 }
开发者ID:atxajon,项目名称:d8cafe,代码行数:32,代码来源:User.php

示例2: prepareRow

 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $row->setSourceProperty('options', unserialize($row->getSourceProperty('options')));
     $row->setSourceProperty('enabled', !$row->getSourceProperty('hidden'));
     $row->setSourceProperty('description', Unicode::truncate($row->getSourceProperty('options/attributes/title'), 255));
     return parent::prepareRow($row);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:10,代码来源:MenuLink.php

示例3: prepareRow

 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $row->setSourceProperty('file_directory_path', $this->filePath);
     $row->setSourceProperty('temp_directory_path', $this->tempFilePath);
     $row->setSourceProperty('is_public', $this->isPublic);
     return parent::prepareRow($row);
 }
开发者ID:ravindrasingh22,项目名称:Drupal-8-rc,代码行数:10,代码来源:File.php

示例4: prepareRow

 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $nid = $row->getSourceProperty('nid');
     // taxonomy term IDs
     // (here we use MySQL's GROUP_CONCAT() function to merge all values into one row.)
     $result = $this->getDatabase()->query('
   SELECT
     GROUP_CONCAT(fld.field_links_tags_tid) as tids
   FROM
     {dcf_field_data_field_links_tags} fld
   WHERE
     fld.entity_id = :nid
 ', array(':nid' => $nid));
     foreach ($result as $record) {
         if (!is_null($record->tids)) {
             $row->setSourceProperty('tags', explode(',', $record->tids));
         }
     }
     // field_url
     $result = $this->getDatabase()->query('
   SELECT
     fld.field_url_url as url,
     fld.field_url_title as title
   FROM
     {dcf_field_data_field_url} fld
   WHERE
     fld.entity_id = :nid
 ', array(':nid' => $nid));
     foreach ($result as $record) {
         $row->setSourceProperty('field_url_url', $record->url);
         $row->setSourceProperty('field_url_title', $record->title);
     }
     return parent::prepareRow($row);
 }
开发者ID:atxajon,项目名称:d8cafe,代码行数:37,代码来源:Link.php

示例5: prepareRow

 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $filters = array();
     $roles = $row->getSourceProperty('roles');
     $row->setSourceProperty('roles', array_values(array_filter(explode(',', $roles))));
     $format = $row->getSourceProperty('format');
     // Find filters for this row.
     $results = $this->select('filters', 'f')->fields('f', array('module', 'delta', 'weight'))->condition('format', $format)->execute();
     foreach ($results as $raw_filter) {
         $module = $raw_filter['module'];
         $delta = $raw_filter['delta'];
         $filter = array('module' => $module, 'delta' => $delta, 'weight' => $raw_filter['weight'], 'settings' => array());
         // Load the filter settings for the filter module, modules can use
         // hook_migration_d6_filter_formats_prepare_row() to add theirs.
         if ($raw_filter['module'] == 'filter') {
             if (!$delta) {
                 if ($setting = $this->variableGet("allowed_html_{$format}", NULL)) {
                     $filter['settings']['allowed_html'] = $setting;
                 }
                 if ($setting = $this->variableGet("filter_html_help_{$format}", NULL)) {
                     $filter['settings']['filter_html_help'] = $setting;
                 }
                 if ($setting = $this->variableGet("filter_html_nofollow_{$format}", NULL)) {
                     $filter['settings']['filter_html_nofollow'] = $setting;
                 }
             } elseif ($delta == 2 && ($setting = $this->variableGet("filter_url_length_{$format}", NULL))) {
                 $filter['settings']['filter_url_length'] = $setting;
             }
         }
         $filters[] = $filter;
     }
     $row->setSourceProperty('filters', $filters);
     return parent::prepareRow($row);
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:37,代码来源:FilterFormat.php

示例6: prepareRow

 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $row->setSourceProperty('filename', basename($row->getSourceProperty('picture')));
     $row->setSourceProperty('file_directory_path', $this->filePath);
     $row->setSourceProperty('temp_directory_path', $this->tempFilePath);
     return parent::prepareRow($row);
 }
开发者ID:dev981,项目名称:gaptest,代码行数:10,代码来源:UserPictureFile.php

示例7: prepareRow

 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $type = $row->getSourceProperty('type');
     $row->setSourceProperty('language_content_type', $this->variableGet('language_content_type_' . $type, NULL));
     $row->setSourceProperty('i18n_lock_node', $this->variableGet('i18n_lock_node_' . $type, 0));
     return parent::prepareRow($row);
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:LanguageContentSettings.php

示例8: prepareRow

  /**
   * {@inheritdoc}
   */
  public function prepareRow(Row $row) {
    // User roles.
    $roles = $this->select('users_roles', 'ur')
      ->fields('ur', array('rid'))
      ->condition('ur.uid', $row->getSourceProperty('uid'))
      ->execute()
      ->fetchCol();
    $row->setSourceProperty('roles', $roles);

    // We are adding here the Event contributed module column.
    // @see https://api.drupal.org/api/drupal/modules%21user%21user.install/function/user_update_7002/7
    if ($row->hasSourceProperty('timezone_id') && $row->getSourceProperty('timezone_id')) {
      if ($this->getDatabase()->schema()->tableExists('event_timezones')) {
        $event_timezone = $this->select('event_timezones', 'e')
          ->fields('e', array('name'))
          ->condition('e.timezone', $row->getSourceProperty('timezone_id'))
          ->execute()
          ->fetchField();
        if ($event_timezone) {
          $row->setSourceProperty('event_timezone', $event_timezone);
        }
      }
    }

    // Unserialize Data.
    $row->setSourceProperty('data', unserialize($row->getSourceProperty('data')));

    return parent::prepareRow($row);
  }
开发者ID:Greg-Boggs,项目名称:electric-dev,代码行数:32,代码来源:User.php

示例9: prepareRow

 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $data = unserialize($row->getSourceProperty('data'));
     $row->setSourceProperty('widget', $data['widget']);
     $row->setSourceProperty('widget_settings', $data['widget']['settings']);
     return parent::prepareRow($row);
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:FieldInstancePerFormDisplay.php

示例10: prepareRow

  /**
   * {@inheritdoc}
   */
  public function prepareRow(Row $row) {
    // Find profile values for this row.
    $query = $this->select('profile_values', 'pv')
      ->fields('pv', array('fid', 'value'));
    $query->leftJoin('profile_fields', 'pf', 'pf.fid=pv.fid');
    $query->fields('pf', array('name', 'type'));
    $query->condition('uid', $row->getSourceProperty('uid'));
    $results = $query->execute();

    foreach ($results as $profile_value) {
      // Check special case for date. We need to unserialize.
      if ($profile_value['type'] == 'date') {
        $date = unserialize($profile_value['value']);
        $date = date('Y-m-d', mktime(0, 0, 0, $date['month'], $date['day'], $date['year']));
        $row->setSourceProperty($profile_value['name'], array('value' => $date));
      }
      elseif ($profile_value['type'] == 'list') {
        // Explode by newline and comma.
        $row->setSourceProperty($profile_value['name'], preg_split("/[\r\n,]+/", $profile_value['value']));
      }
      else {
        $row->setSourceProperty($profile_value['name'], array($profile_value['value']));
      }
    }

    return parent::prepareRow($row);
  }
开发者ID:Greg-Boggs,项目名称:electric-dev,代码行数:30,代码来源:ProfileFieldValues.php

示例11: prepareRow

 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     // Find node types for this row.
     $node_types = $this->select('vocabulary_node_types', 'nt')->fields('nt', array('type', 'vid'))->condition('vid', $row->getSourceProperty('vid'))->execute()->fetchCol();
     $row->setSourceProperty('node_types', $node_types);
     $row->setSourceProperty('cardinality', $row->getSourceProperty('tags') == 1 || $row->getSourceProperty('multiple') == 1 ? FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED : 1);
     return parent::prepareRow($row);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:11,代码来源:Vocabulary.php

示例12: prepareRow

 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     // Find parents for this row.
     $query = $this->select('wp_term_taxonomy', 'wptt')->fields('wptt', array('parent', 'term_id', 'taxonomy', 'description'))->condition('term_id', $row->getSourceProperty('term_id'))->execute()->fetchAssoc();
     $row->setSourceProperty('parent', $query['parent']);
     $row->setSourceProperty('description', $query['description']);
     $row->setSourceProperty('vid', $query['taxonomy']);
     return parent::prepareRow($row);
 }
开发者ID:gl-prout,项目名称:d8_migrate_wordpress,代码行数:12,代码来源:Terms.php

示例13: prepareRow

 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $rid = $row->getSourceProperty('rid');
     $permissions = $this->select('permission', 'p')->fields('p', array('perm'))->condition('rid', $rid)->execute()->fetchField();
     $row->setSourceProperty('permissions', explode(', ', $permissions));
     if (isset($this->filterPermissions[$rid])) {
         $row->setSourceProperty("filter_permissions:{$rid}", $this->filterPermissions[$rid]);
     }
     return parent::prepareRow($row);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:13,代码来源:Role.php

示例14: prepareRow

 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     // Unserialize data.
     $widget_settings = unserialize($row->getSourceProperty('widget_settings'));
     $display_settings = unserialize($row->getSourceProperty('display_settings'));
     $global_settings = unserialize($row->getSourceProperty('global_settings'));
     $row->setSourceProperty('widget_settings', $widget_settings);
     $row->setSourceProperty('display_settings', $display_settings);
     $row->setSourceProperty('global_settings', $global_settings);
     return parent::prepareRow($row);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:14,代码来源:FieldInstance.php

示例15: prepareRow

 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $cid = $row->getSourceProperty('cid');
     $node_type = $row->getSourceProperty('node_type');
     $comment_type = 'comment_node_' . $node_type;
     $row->setSourceProperty('comment_type', 'comment_node_' . $node_type);
     foreach (array_keys($this->getFields('comment', $comment_type)) as $field) {
         $row->setSourceProperty($field, $this->getFieldValues('comment', $field, $cid));
     }
     return parent::prepareRow($row);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:14,代码来源:Comment.php


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