Skip to content
Snippets Groups Projects

ZERO-162-changes

Open Eduarda Lentz Rodrigues da Silva requested to merge ZERO-162-changes into develop
Compare and Show latest version
3 files
+ 92
15
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -22,6 +22,7 @@ namespace Firegento\ContentProvisioning\Model\Console;
use Firegento\ContentProvisioning\Model\Query\GetBlockEntryList;
use Firegento\ContentProvisioning\Model\Query\GetChangedBlockIdentifiers;
use Firegento\ContentProvisioning\Model\Query\GetFilesContentInformation;
use Firegento\ContentProvisioning\ViewModel\BlockDataProvider;
use Firegento\ContentProvisioning\ViewModel\ChangedBlockDataProvider;
use Magento\Framework\Console\Cli;
use Magento\Framework\Exception\LocalizedException;
@@ -57,11 +58,17 @@ class BlockListCommand extends Command
*/
private GetFilesContentInformation $getFilesContentInformation;
/**
* @var BlockDataProvider
*/
private BlockDataProvider $blockDataProvider;
/**
* @param GetBlockEntryList $getAllBlockEntries
* @param GetFilesContentInformation $getFilesContentInformation
* @param GetChangedBlockIdentifiers $getChangedBlocksIdentifier
* @param ChangedBlockDataProvider $changedBlockDataProvider
* @param BlockDataProvider $blockDataProvider
* @param string|null $name
*/
public function __construct(
@@ -69,12 +76,14 @@ class BlockListCommand extends Command
GetFilesContentInformation $getFilesContentInformation,
GetChangedBlockIdentifiers $getChangedBlocksIdentifier,
ChangedBlockDataProvider $changedBlockDataProvider,
BlockDataProvider $blockDataProvider,
string $name = null
) {
$this->getAllBlockEntries = $getAllBlockEntries;
$this->getFilesContentInformation = $getFilesContentInformation;
$this->getChangedBlocksIdentifier = $getChangedBlocksIdentifier;
$this->changedBlockDataProvider = $changedBlockDataProvider;
$this->blockDataProvider = $blockDataProvider;
parent::__construct($name);
}
@@ -88,12 +97,13 @@ class BlockListCommand extends Command
public function execute(InputInterface $input, OutputInterface $output): int
{
if ($input->getOption(self::PARAM_CHANGED_ONLY)) {
$entries = $this->getChangedEntries();
$changedBlockEntries = $this->getChangedCmsBlockEntries();
$this->changedBlockDataProvider->execute($output, $changedBlockEntries);
} else {
$entries = $this->getAllBlockEntries->get();
$blockEntries = $this->getAllBlockEntries->get();
$this->blockDataProvider->execute($output, $blockEntries);
}
$this->changedBlockDataProvider->execute($output, $entries);
return Cli::RETURN_SUCCESS;
}
@@ -117,7 +127,7 @@ class BlockListCommand extends Command
* @return string[]
* @throws \Exception
*/
public function getChangedEntries(): array
public function getChangedCmsBlockEntries(): array
{
$files = $this->getFilesContentInformation->execute();
return $this->getChangedBlocksIdentifier->execute($files);
Loading