-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from nlisgo/feature/articles_endpoint_for_mig…
…ration Add alternative endpoint for articles during migration
- Loading branch information
Showing
12 changed files
with
99 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace Drupal\jcms_migrate; | ||
|
||
use Drupal\Core\Entity\EntityInterface; | ||
use Drupal\Core\Entity\EntityTypeManager; | ||
use Drupal\jcms_article\Entity\ArticleVersions; | ||
use Drupal\node\Entity\Node; | ||
use Drupal\paragraphs\Entity\Paragraph; | ||
|
||
/** | ||
* Class ArticleCrud | ||
* | ||
* @package Drupal\jcms_migrate | ||
*/ | ||
class ArticleCrud extends \Drupal\jcms_article\ArticleCrud { | ||
|
||
/** | ||
* ArticleCrud constructor. | ||
* | ||
* @param \Drupal\Core\Entity\EntityTypeManager $entity_type_manager | ||
*/ | ||
public function __construct(EntityTypeManager $entity_type_manager) { | ||
parent::__construct($entity_type_manager); | ||
} | ||
|
||
/** | ||
* Creates a new article node. | ||
* | ||
* @param \Drupal\jcms_article\Entity\ArticleVersions $articleVersions | ||
* | ||
* @return \Drupal\Core\Entity\EntityInterface | ||
*/ | ||
public function createArticle(ArticleVersions $articleVersions) { | ||
$node = Node::create([ | ||
'type' => 'article', | ||
'title' => $articleVersions->getId(), | ||
]); | ||
// Set flag for article nodes created during migration. | ||
$node->migration = TRUE; | ||
$paragraph = $this->createParagraph($node, $articleVersions); | ||
$node->field_article_json = [ | ||
[ | ||
'target_id' => $paragraph->id(), | ||
'target_revision_id' => $paragraph->getRevisionId(), | ||
], | ||
]; | ||
$node->save(); | ||
return $node; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters