Sulu CMS Import articles from an existing CMS
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
<?php | |
// src/Commands/ImportExternalCmsCommand.php | |
namespace App\Commands; | |
use Doctrine\ORM\EntityManagerInterface; | |
use Sulu\Component\DocumentManager\DocumentManagerInterface; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
class ImportExternalCmsCommand extends Command | |
{ | |
protected static $defaultName = 'sulu:import-external-cms'; | |
protected static $defaultDescription = 'Import all articles from an external CMS via DBAL and create Sulu articles with the document manager.'; | |
private $entityManager; | |
private $documentManager; | |
public function __construct(EntityManagerInterface $entityManager, DocumentManagerInterface $documentManager) | |
{ | |
$this->entityManager = $entityManager; | |
$this->documentManager = $documentManager; | |
parent::__construct(); | |
} | |
protected function execute(InputInterface $input, OutputInterface $output): int | |
{ | |
// TODO: | |
// - query old articles via entity manager | |
// - return Generator with articles data | |
// - save articles via document manager | |
return 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment