X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Frdf%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd7%2FRdfMapping.php;fp=web%2Fcore%2Fmodules%2Frdf%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd7%2FRdfMapping.php;h=2dca9e01e28dfea8dabf3925dc6f71afa18b5a0f;hp=0000000000000000000000000000000000000000;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/rdf/src/Plugin/migrate/source/d7/RdfMapping.php b/web/core/modules/rdf/src/Plugin/migrate/source/d7/RdfMapping.php new file mode 100644 index 000000000..2dca9e01e --- /dev/null +++ b/web/core/modules/rdf/src/Plugin/migrate/source/d7/RdfMapping.php @@ -0,0 +1,70 @@ +select('rdf_mapping', 'r')->fields('r'); + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + $field_mappings = []; + foreach (unserialize($row->getSourceProperty('mapping')) as $field => $mapping) { + if ($field === 'rdftype') { + $row->setSourceProperty('types', $mapping); + } + else { + $field_mappings[$field] = $mapping; + } + } + $row->setSourceProperty('fieldMappings', $field_mappings); + + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function fields() { + return [ + 'type' => $this->t('The name of the entity type a mapping applies to (node, user, comment, etc.'), + 'bundle' => $this->t('The name of the bundle a mapping applies to.'), + 'mapping' => $this->t('The serialized mapping of the bundle type and fields to RDF terms.'), + 'types' => $this->t('RDF types.'), + 'fieldMappings' => $this->t('RDF field mappings.'), + ]; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + return [ + 'type' => [ + 'type' => 'string', + ], + 'bundle' => [ + 'type' => 'string', + ], + ]; + } + +}