|
@@ -5,6 +5,7 @@ namespace Drupal\popsu_migrate\Plugin\migrate\source;
|
|
|
|
|
|
use Drupal\migrate\Row;
|
|
|
use Drush\Drush;
|
|
|
+use Drupal\paragraphs\Entity\Paragraph;
|
|
|
|
|
|
// use Drupal\popsu_migrate\Plugin\migrate\source\D7Programme;
|
|
|
|
|
@@ -18,6 +19,22 @@ use Drush\Drush;
|
|
|
*/
|
|
|
class D7NodeProgramme extends D7Programme {
|
|
|
|
|
|
+ /**
|
|
|
+ * {@inheritdoc}
|
|
|
+ */
|
|
|
+ public function query() {
|
|
|
+ $query = parent::query($row);
|
|
|
+
|
|
|
+ // field_popsu_special_typetaxo 31 (Acueile)
|
|
|
+ $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;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* {@inheritdoc}
|
|
|
*/
|
|
@@ -48,14 +65,31 @@ class D7NodeProgramme extends D7Programme {
|
|
|
$row->setSourceProperty('body', $body[0]['value']);
|
|
|
$row->setSourceProperty('body_summary', $body[0]['summary']);
|
|
|
|
|
|
- // texts (migration_lookup)
|
|
|
- $row->setSourceProperty('text_paragraphe_id', $nid);
|
|
|
-
|
|
|
// associateds
|
|
|
$associateds = $this->getAssociatedSpecial($field_popsu_special_popsu_tid);
|
|
|
Drush::output()->writeln(dump($associateds));
|
|
|
|
|
|
+ // texts (migration_lookup)
|
|
|
+ $text = $row->getSourceProperty('field_popsu_special_text');
|
|
|
+ $text[0]['format'] = 'wysiwyg';
|
|
|
+ $p = Paragraph::create(['type' => 'textes']);
|
|
|
+ $p->set('field_texte', $text)
|
|
|
+ ->set('field_titre', $row->getSourceProperty('title'))
|
|
|
+ ->isNew();
|
|
|
+ $p->save();
|
|
|
+
|
|
|
+ $text_paragraphe = array(
|
|
|
+ array(
|
|
|
+ 'target_id' => $p->id(),
|
|
|
+ 'target_revision_id' => $p->getRevisionId(),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ $row->setSourceProperty('text_paragraphe', $text_paragraphe);
|
|
|
+
|
|
|
+ // Sous partie
|
|
|
+
|
|
|
// fichiers
|
|
|
+ // files from current node
|
|
|
$fichiers = array();
|
|
|
foreach ($row->getSourceProperty('field_popsu_special_insert') as $value) {
|
|
|
$fichiers[] = $value;
|