|
@@ -15,6 +15,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
|
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
|
|
|
use Drush\Drush;
|
|
|
|
|
|
+use Drupal\popsu_migrate\Plugin\migrate\source\D7Programme;
|
|
|
+
|
|
|
/**
|
|
|
* Drupal 7 node source from database.
|
|
|
*
|
|
@@ -23,92 +25,7 @@ use Drush\Drush;
|
|
|
* source_module = "node"
|
|
|
* )
|
|
|
*/
|
|
|
-class D7PargrapheTextsProgramme extends FieldableEntity {
|
|
|
- /**
|
|
|
- * The module handler.
|
|
|
- *
|
|
|
- * @var \Drupal\Core\Extension\ModuleHandlerInterface
|
|
|
- */
|
|
|
- protected $moduleHandler;
|
|
|
-
|
|
|
- /**
|
|
|
- * The logger channel.
|
|
|
- *
|
|
|
- * @var \Drupal\Core\Logger\LoggerChannelInterface
|
|
|
- */
|
|
|
- protected $logger;
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * {@inheritdoc}
|
|
|
- */
|
|
|
- public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_manager, ModuleHandlerInterface $module_handler,LoggerChannelFactoryInterface $loggerFactory) {
|
|
|
- parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
|
|
|
- $this->moduleHandler = $module_handler;
|
|
|
- $this->logger = $loggerFactory->get('popsu_migration');
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * {@inheritdoc}
|
|
|
- */
|
|
|
- public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
|
|
|
- return new static(
|
|
|
- $configuration,
|
|
|
- $plugin_id,
|
|
|
- $plugin_definition,
|
|
|
- $migration,
|
|
|
- $container->get('state'),
|
|
|
- $container->get('entity_type.manager'),
|
|
|
- $container->get('module_handler'),
|
|
|
- $container->get('logger.factory')
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * The join options between the node and the node_revisions table.
|
|
|
- */
|
|
|
- const JOIN = 'n.vid = nr.vid';
|
|
|
-
|
|
|
- /**
|
|
|
- * {@inheritdoc}
|
|
|
- */
|
|
|
- public function query() {
|
|
|
- // Select node in its last revision.
|
|
|
- $query = $this->select('node_revision', 'nr')
|
|
|
- ->fields('n', [
|
|
|
- 'nid',
|
|
|
- 'type',
|
|
|
- 'uid',
|
|
|
- 'language',
|
|
|
- 'status',
|
|
|
- 'created',
|
|
|
- 'changed',
|
|
|
- ])
|
|
|
- ->fields('nr', [
|
|
|
- 'vid',
|
|
|
- 'title',
|
|
|
- 'log',
|
|
|
- 'timestamp',
|
|
|
- ])
|
|
|
- ->orderBy('changed');
|
|
|
-
|
|
|
- $query->addField('n', 'uid', 'node_uid');
|
|
|
- $query->addField('nr', 'uid', 'revision_uid');
|
|
|
- $query->innerJoin('node', 'n', static::JOIN);
|
|
|
-
|
|
|
- if (isset($this->configuration['node_type'])) {
|
|
|
- $query->condition('n.type', $this->configuration['node_type']);
|
|
|
- }
|
|
|
-
|
|
|
- // field_popsu_special_typetaxo 31
|
|
|
- $query->leftJoin('field_revision_field_popsu_special_typetaxo', 'ff', 'ff.revision_id = n.vid');
|
|
|
- $query->fields('ff', [
|
|
|
- 'field_popsu_special_typetaxo_tid'
|
|
|
- ]);
|
|
|
- $query->condition('ff.field_popsu_special_typetaxo_tid', 31);
|
|
|
-
|
|
|
- return $query;
|
|
|
- }
|
|
|
+class D7PargrapheTextsProgramme extends D7Programme {
|
|
|
|
|
|
/**
|
|
|
* {@inheritdoc}
|
|
@@ -137,36 +54,4 @@ class D7PargrapheTextsProgramme extends FieldableEntity {
|
|
|
return parent::prepareRow($row);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * {@inheritdoc}
|
|
|
- */
|
|
|
- public function fields() {
|
|
|
- $fields = [
|
|
|
- 'nid' => $this->t('Node ID'),
|
|
|
- 'type' => $this->t('Type'),
|
|
|
- 'title' => $this->t('Title'),
|
|
|
- 'node_uid' => $this->t('Node authored by (uid)'),
|
|
|
- 'revision_uid' => $this->t('Revision authored by (uid)'),
|
|
|
- 'created' => $this->t('Created timestamp'),
|
|
|
- 'changed' => $this->t('Modified timestamp'),
|
|
|
- 'status' => $this->t('Published'),
|
|
|
- 'promote' => $this->t('Promoted to front page'),
|
|
|
- 'sticky' => $this->t('Sticky at top of lists'),
|
|
|
- 'revision' => $this->t('Create new revision'),
|
|
|
- 'language' => $this->t('Language (fr, en, ...)'),
|
|
|
- 'tnid' => $this->t('The translation set id for this node'),
|
|
|
- 'timestamp' => $this->t('The timestamp the latest revision of this node was created.'),
|
|
|
- ];
|
|
|
- return $fields;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * {@inheritdoc}
|
|
|
- */
|
|
|
- public function getIds() {
|
|
|
- $ids['nid']['type'] = 'integer';
|
|
|
- $ids['nid']['alias'] = 'n';
|
|
|
- return $ids;
|
|
|
- }
|
|
|
-
|
|
|
}
|