本文整理汇总了PHP中Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase类的典型用法代码示例。如果您正苦于以下问题:PHP DrupalSqlBase类的具体用法?PHP DrupalSqlBase怎么用?PHP DrupalSqlBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DrupalSqlBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
$vocab = $row->getSourceProperty('taxonomy');
$label = $vocab == 'category' ? 'Category' : 'Post Tags';
$row->setSourceProperty('label', $label);
return parent::prepareRow($row);
}
示例2: 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);
}
示例3: 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);
}
示例4: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
if ($value = $row->getSourceProperty('value')) {
$row->setSourceProperty('value', unserialize($value));
}
return parent::prepareRow($row);
}
示例5: 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);
}
示例6: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
// Select all related tickets (rnid) to the current ticket (nid)
$query = $this->select('support_reference', 'sr')->fields('sr', array('rnid'))->condition('sr.nid', $row->getSourceProperty('nid'));
$row->setSourceProperty('rnid', $query->execute()->fetchCol());
return parent::prepareRow($row);
}
示例7: 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);
}
示例8: 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);
}
示例9: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
$post_type = $row->getSourceProperty('post_type');
$type = $post_type == 'page' ? 'page' : 'article';
$row->setSourceProperty('type', $type);
return parent::prepareRow($row);
}
示例10: 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);
}
示例11: 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);
}
示例12: 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);
}
示例13: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
$row->setSourceProperty('teaser_length', $this->teaserLength);
$row->setSourceProperty('node_preview', $this->nodePreview);
$type = $row->getSourceProperty('type');
$source_options = $this->variableGet('node_options_' . $type, array('promote', 'sticky'));
$options = array();
foreach (array('promote', 'sticky', 'status', 'revision') as $item) {
$options[$item] = in_array($item, $source_options);
}
$row->setSourceProperty('options', $options);
// Don't create a body field until we prove that this node type has one.
$row->setSourceProperty('create_body', FALSE);
if ($this->moduleExists('field')) {
// Find body field for this node type.
$body = $this->select('field_config_instance', 'fci')->fields('fci', array('data'))->condition('entity_type', 'node')->condition('bundle', $row->getSourceProperty('type'))->condition('field_name', 'body')->execute()->fetchAssoc();
if ($body) {
$row->setSourceProperty('create_body', TRUE);
$body['data'] = unserialize($body['data']);
$row->setSourceProperty('body_label', $body['data']['label']);
}
}
$row->setSourceProperty('display_submitted', $this->variableGet('node_submitted_' . $type, TRUE));
return parent::prepareRow($row);
}
示例14: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
// Find parents for this row.
$parents = $this->select('term_hierarchy', 'th')->fields('th', array('parent', 'tid'))->condition('tid', $row->getSourceProperty('tid'))->execute()->fetchCol();
$row->setSourceProperty('parent', $parents);
return parent::prepareRow($row);
}
示例15: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row, $keep = TRUE)
{
foreach (unserialize($row->getSourceProperty('data')) as $key => $value) {
$row->setSourceProperty($key, $value);
}
return parent::prepareRow($row);
}