Log.php in Log entity 2.x
File
src/Plugin/migrate/source/d7/Log.php
View source
<?php
namespace Drupal\log\Plugin\migrate\source\d7;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
class Log extends FieldableEntity {
public function query() {
$query = $this
->select('log', 'l')
->fields('l')
->distinct()
->orderBy('id');
if (isset($this->configuration['bundle'])) {
$query
->condition('l.type', (array) $this->configuration['bundle'], 'IN');
}
return $query;
}
public function fields() {
$fields = [
'id' => $this
->t('The log ID'),
'name' => $this
->t('The log name'),
'type' => $this
->t('The log type'),
'uid' => $this
->t('The log author ID'),
'timestamp' => $this
->t('Timestamp of the event being logged'),
'created' => $this
->t('Timestamp when the log was created'),
'changed' => $this
->t('Timestamp when the log was last modified'),
'done' => $this
->t('Boolean indicating whether the log is done (the event happened)'),
];
return $fields;
}
public function prepareRow(Row $row) {
$id = $row
->getSourceProperty('id');
$type = $row
->getSourceProperty('type');
foreach ($this
->getFields('log', $type) as $field_name => $field) {
$row
->setSourceProperty($field_name, $this
->getFieldValues('log', $field_name, $id));
}
return parent::prepareRow($row);
}
public function getIds() {
$ids['id']['type'] = 'integer';
return $ids;
}
}
Classes
Name |
Description |
Log |
Log source from database. |