Skip to content
Snippets Groups Projects
Commit 4766562d authored by Vadim Justus's avatar Vadim Justus
Browse files

Introduce content entry key

parent aa119c75
No related branches found
No related tags found
No related merge requests found
......@@ -13,12 +13,18 @@ interface ContentEntryInterface
const CONTENT = 'content';
const STORES = 'stores';
const IS_MAINTAINED = 'is_maintained';
const KEY = 'key';
/**
* @return string
*/
public function getType(): string;
/**
* @return string
*/
public function getKey(): string;
/**
* @return string
*/
......@@ -44,6 +50,11 @@ interface ContentEntryInterface
*/
public function setType(string $type): void;
/**
* @param string $key
*/
public function setKey(string $key): void;
/**
* @param string $identifier
*/
......
......@@ -68,7 +68,9 @@ class Converter implements \Magento\Framework\Config\ConverterInterface
$identifier = $this->getAttributeValue($node, 'identifier');
try {
$stores = $this->extractStores($node);
$output[$this->buildKey($identifier, $stores, $nodeKey)] = [
$key = $this->buildKey($identifier, $stores, $nodeKey);
$output[$key] = [
ContentEntryInterface::KEY => $key,
ContentEntryInterface::IDENTIFIER => $identifier,
ContentEntryInterface::TYPE => $nodeKey,
ContentEntryInterface::IS_MAINTAINED =>
......
......@@ -34,10 +34,11 @@ class ListCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output)
{
$table = new Table($output);
$table->setHeaders(['Type', 'Identifier', 'Stores', 'Maintained', 'Content (Teaser)']);
$table->setHeaders(['Key', 'Type', 'Identifier', 'Stores', 'Maintained', 'Content (Teaser)']);
foreach ($this->getAllContentEntries->get() as $entry) {
$table->addRow([
$entry->getKey(),
$entry->getType(),
$entry->getIdentifier(),
implode(', ', $entry->getStores()),
......
......@@ -16,6 +16,14 @@ class ContentEntry extends DataObject implements ContentEntryInterface
return (string)$this->getData(ContentEntryInterface::TYPE);
}
/**
* @return string
*/
public function getKey(): string
{
return (string)$this->getData(ContentEntryInterface::KEY);
}
/**
* @return string
*/
......@@ -56,6 +64,14 @@ class ContentEntry extends DataObject implements ContentEntryInterface
$this->setData(ContentEntryInterface::TYPE, $type);
}
/**
* @param string $key
*/
public function setKey(string $key): void
{
$this->setData(ContentEntryInterface::KEY, $key);
}
/**
* @param string $identifier
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment