popsu_migrate: D7NodeProgramme sous partie paragraphe ok (missing node-reference on events)
This commit is contained in:
		@@ -62,12 +62,7 @@ process:
 | 
			
		||||
 | 
			
		||||
  field_textes: text_paragraphe
 | 
			
		||||
 | 
			
		||||
  # field_popsu_special_insert_intro
 | 
			
		||||
  # field_popsu_special_insert
 | 
			
		||||
  # field_fichier:
 | 
			
		||||
  #   plugin: migration_lookup
 | 
			
		||||
  #   migration: d7_allpublicfiles
 | 
			
		||||
  #   source: fichiers
 | 
			
		||||
  field_sous_parties: sous_parties
 | 
			
		||||
 | 
			
		||||
  field_fichier:
 | 
			
		||||
    plugin: sub_process
 | 
			
		||||
 
 | 
			
		||||
@@ -87,6 +87,47 @@ class D7NodeProgramme extends D7Programme {
 | 
			
		||||
    $row->setSourceProperty('text_paragraphe', $text_paragraphe);
 | 
			
		||||
 | 
			
		||||
    // Sous partie
 | 
			
		||||
    // looping through special_type
 | 
			
		||||
    $sous_parties = array();
 | 
			
		||||
    foreach (['colloques', 'publications'] as $special_type) {
 | 
			
		||||
      $ps = array();
 | 
			
		||||
      // looping through nodes
 | 
			
		||||
      foreach ($associateds[$special_type] as $key => $special) {
 | 
			
		||||
        // looping through fields
 | 
			
		||||
        foreach (['field_popsu_special_body', 'field_popsu_special_text'] as $field) {
 | 
			
		||||
          if (!empty($special[$field])) {
 | 
			
		||||
            // creating the sous partie contents (sub paragraphes)
 | 
			
		||||
            $text = $special[$field][0];
 | 
			
		||||
            $text[0]['format'] = 'wysiwyg';
 | 
			
		||||
            $p = Paragraph::create(['type' => 'sous_partie_programme_contents']);
 | 
			
		||||
            $p->set('field_texte', $text)
 | 
			
		||||
              ->set('field_titre', $special['title'])
 | 
			
		||||
              // TODO ->set('field_liste_contenus',) migration_lookup on popsu_colloques -> evenements
 | 
			
		||||
              ->isNew();
 | 
			
		||||
            $p->save();
 | 
			
		||||
            $ps[] = array(
 | 
			
		||||
              'target_id' => $p->id(),
 | 
			
		||||
              'target_revision_id' => $p->getRevisionId(),
 | 
			
		||||
            );
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      if (!empty($ps)) {
 | 
			
		||||
        // creating sous partie (paragraphe)
 | 
			
		||||
        $p = Paragraph::create(['type' => 'sous_partie_programme']);
 | 
			
		||||
        $p->set('field_sous_partie_contenus', $ps)
 | 
			
		||||
          ->set('field_titre', $special_type)
 | 
			
		||||
          ->isNew();
 | 
			
		||||
        $p->save();
 | 
			
		||||
        $sous_parties[] = array(
 | 
			
		||||
          'target_id' => $p->id(),
 | 
			
		||||
          'target_revision_id' => $p->getRevisionId(),
 | 
			
		||||
        );
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    if (!empty($sous_parties)) {
 | 
			
		||||
      $row->setSourceProperty('sous_parties', $sous_parties);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // fichiers
 | 
			
		||||
    // files from current node
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user