Skip to content

Commit

Permalink
Merge pull request #7289 from spryker/feature/mp-2849/master-api-cms-…
Browse files Browse the repository at this point in the history
…pages

MP-2849 API: CMS pages (basic attributes)
  • Loading branch information
Spryker Release Bot authored Jul 15, 2020
2 parents e85787b + 7e52753 commit 8f32a24
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "proprietary",
"require": {
"php": ">=7.2",
"spryker/content-storage": "^2.0.0",
"spryker/content-storage": "^2.4.0",
"spryker/kernel": "^3.32.0"
},
"require-dev": {
Expand Down
19 changes: 19 additions & 0 deletions src/Spryker/Client/ContentProduct/ContentProductClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,23 @@ public function executeProductAbstractListTypeByKey(string $contentKey, string $
->createContentProductAbstractListTypeMapper()
->executeProductAbstractListTypeByKey($contentKey, $localeName);
}

/**
* {@inheritDoc}
*
* @api
*
* @phpstan-return array<string, \Generated\Shared\Transfer\ContentProductAbstractListTypeTransfer>
*
* @param string[] $contentKeys
* @param string $localeName
*
* @return \Generated\Shared\Transfer\ContentProductAbstractListTypeTransfer[]
*/
public function executeProductAbstractListTypeByKeys(array $contentKeys, string $localeName): array
{
return $this->getFactory()
->createContentProductAbstractListTypeMapper()
->executeProductAbstractListTypeByKeys($contentKeys, $localeName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,21 @@ interface ContentProductClientInterface
* @return \Generated\Shared\Transfer\ContentProductAbstractListTypeTransfer|null
*/
public function executeProductAbstractListTypeByKey(string $contentKey, string $localeName): ?ContentProductAbstractListTypeTransfer;

/**
* Specification:
* - Finds content items in the key-value storage by content keys and locale name.
* - Gets stored term for found content items.
* - Executes stored term with found content items to get a collection of content product abstract list type.
*
* @api
*
* @phpstan-return array<string, \Generated\Shared\Transfer\ContentProductAbstractListTypeTransfer>
*
* @param string[] $contentKeys
* @param string $localeName
*
* @return \Generated\Shared\Transfer\ContentProductAbstractListTypeTransfer[]
*/
public function executeProductAbstractListTypeByKeys(array $contentKeys, string $localeName): array;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,17 @@ public function findContentTypeContextByKey(string $contentKey, string $localeNa
{
return $this->contentStorageClient->findContentTypeContextByKey($contentKey, $localeName);
}

/**
* @phpstan-return array<string, \Generated\Shared\Transfer\ContentTypeContextTransfer>
*
* @param string[] $contentKeys
* @param string $localeName
*
* @return \Generated\Shared\Transfer\ContentTypeContextTransfer[]
*/
public function getContentTypeContextByKeys(array $contentKeys, string $localeName): array
{
return $this->contentStorageClient->getContentTypeContextByKeys($contentKeys, $localeName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,14 @@ interface ContentProductToContentStorageClientInterface
* @return \Generated\Shared\Transfer\ContentTypeContextTransfer|null
*/
public function findContentTypeContextByKey(string $contentKey, string $localeName): ?ContentTypeContextTransfer;

/**
* @phpstan-return array<string, \Generated\Shared\Transfer\ContentTypeContextTransfer>
*
* @param string[] $contentKeys
* @param string $localeName
*
* @return \Generated\Shared\Transfer\ContentTypeContextTransfer[]
*/
public function getContentTypeContextByKeys(array $contentKeys, string $localeName): array;
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,38 @@ public function executeProductAbstractListTypeByKey(string $contentKey, string $

return $productAbstractListTermToProductAbstractListTypeExecutor->execute($contentTypeContextTransfer);
}

/**
* @phpstan-return array<string, \Generated\Shared\Transfer\ContentProductAbstractListTypeTransfer>
*
* @param string[] $contentKeys
* @param string $localeName
*
* @return \Generated\Shared\Transfer\ContentProductAbstractListTypeTransfer[]
*/
public function executeProductAbstractListTypeByKeys(array $contentKeys, string $localeName): array
{
$contentTypeContextTransfers = $this->contentStorageClient->getContentTypeContextByKeys(
$contentKeys,
$localeName
);

if (!$contentTypeContextTransfers) {
return [];
}

$contentProductAbstractListTypeTransfers = [];
foreach ($contentTypeContextTransfers as $contentTypeContextTransfer) {
$term = $contentTypeContextTransfer->getTerm();
if (!isset($this->contentProductTermExecutors[$term])) {
return [];
}

$productAbstractListTermToBannerTypeExecutor = $this->contentProductTermExecutors[$term];

$contentProductAbstractListTypeTransfers[$contentTypeContextTransfer->getKey()] = $productAbstractListTermToBannerTypeExecutor->execute($contentTypeContextTransfer);
}

return $contentProductAbstractListTypeTransfers;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,14 @@ interface ContentProductAbstractListTypeMapperInterface
* @return \Generated\Shared\Transfer\ContentProductAbstractListTypeTransfer|null
*/
public function executeProductAbstractListTypeByKey(string $contentKey, string $localeName): ?ContentProductAbstractListTypeTransfer;

/**
* @phpstan-return array<string, \Generated\Shared\Transfer\ContentProductAbstractListTypeTransfer>
*
* @param string[] $contentKeys
* @param string $localeName
*
* @return \Generated\Shared\Transfer\ContentProductAbstractListTypeTransfer[]
*/
public function executeProductAbstractListTypeByKeys(array $contentKeys, string $localeName): array;
}

0 comments on commit 8f32a24

Please sign in to comment.