VariableMultiRow.php in Zircon Profile 8
File
core/modules/migrate_drupal/src/Plugin/migrate/source/VariableMultiRow.php
View source
<?php
namespace Drupal\migrate_drupal\Plugin\migrate\source;
use Drupal\migrate\Row;
class VariableMultiRow extends DrupalSqlBase {
public function query() {
return $this
->select('variable', 'v')
->fields('v', array(
'name',
'value',
))
->condition('name', (array) $this->configuration['variables'], 'IN');
}
public function fields() {
return array(
'name' => $this
->t('Name'),
'value' => $this
->t('Value'),
);
}
public function prepareRow(Row $row) {
if ($value = $row
->getSourceProperty('value')) {
$row
->setSourceProperty('value', unserialize($value));
}
return parent::prepareRow($row);
}
public function getIds() {
$ids['name']['type'] = 'string';
return $ids;
}
}