Commit 6b965e48 authored by Reena Raghavan's avatar Reena Raghavan

Modified Article.php

parent 6911d89e
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f26dfb2782bddb8f9bd1a658e1785794",
"content-hash": "a4bf52f850f04f4eb14670f5eb177c2e",
"packages": [
{
"name": "asm89/stack-cors",
......@@ -1557,6 +1557,52 @@
},
"time": "2022-10-06T15:57:08+00:00"
},
{
"name": "drupal/custom_sql_migrate_source_plugin",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/custom_sql_migrate_source_plugin.git",
"reference": "8.x-1.3"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/custom_sql_migrate_source_plugin-8.x-1.3.zip",
"reference": "8.x-1.3",
"shasum": "0b73700e93408d58e8c63f8d959aa5be503865bd"
},
"require": {
"drupal/core": "^8 || ^9",
"drupal/migrate_plus": "*",
"drupal/migrate_tools": "*"
},
"type": "drupal-module",
"extra": {
"drupal": {
"version": "8.x-1.3",
"datestamp": "1643744726",
"security-coverage": {
"status": "not-covered",
"message": "Project has not opted into security advisory coverage!"
}
}
},
"notification-url": "https://packages.drupal.org/8/downloads",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "swiftsystems",
"homepage": "https://www.drupal.org/user/3157639"
}
],
"description": "Migrations of content via custom SQL string.",
"homepage": "https://www.drupal.org/project/custom_sql_migrate_source_plugin",
"support": {
"source": "https://git.drupalcode.org/project/custom_sql_migrate_source_plugin"
}
},
{
"name": "drupal/migrate_plus",
"version": "6.0.0",
......@@ -10535,5 +10581,5 @@
"php": ">=7.4"
},
"platform-dev": [],
"plugin-api-version": "2.2.0"
"plugin-api-version": "2.3.0"
}
......@@ -13,7 +13,6 @@ process:
nid: nid
title: title
body: body
field_publish_date: field_publish_date
migration_dependencies:
required: {}
......
......@@ -26,9 +26,11 @@ class Article extends SqlBase
*/
public function query()
{
$query = $this->select('custom_news', 'cn')
->fields('cn', ['nid','title','body','field_publish_date']);
$query = $this->select('node_field_data', 'ar')
->fields('ar', ['nid','title','body']);
return $query;
}
/**
......@@ -39,8 +41,7 @@ public function fields()
$fields = [
'nid' => $this->t('nid'),
'title' => $this->t('title'),
'body' => $this->t('body'),
'field_publish_date' => $this->t('field_publish_date')
'body' => $this->t('body')
];
return $fields;
......@@ -54,7 +55,7 @@ public function getIds()
return [
'nid' => [
'type' => 'integer',
'alias' => 'cn',
'alias' => 'ar',
],
];
}
......@@ -62,11 +63,11 @@ public function getIds()
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
$publish_date = $row->getSourceProperty('publish_date');
$new_date = date('Y-m-d\Th:i:s', strtotime($publish_date));
$row->setSourceProperty('publish_date', $new_date);
return parent::prepareRow($row);
}
// public function prepareRow(Row $row)
// {
// $publish_date = $row->getSourceProperty('publish_date');
// $new_date = date('Y-m-d\Th:i:s', strtotime($publish_date));
// $row->setSourceProperty('publish_date', $new_date);
// return parent::prepareRow($row);
// }
}
<?php
/**
* @file
* Install, update and uninstall functions for the Uvf migrate module.
*/
/**
* Implements hook_uninstall().
*/
function uvf_migrate_uninstall() {
$configs = [
'migrate_plus.migration.article'
];
foreach($configs as $config){
$delete = \Drupal::database()->delete('config')
->condition('name', $config)
->execute();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment