Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ContentResolver to ContentAggregator #272

Merged
merged 5 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
* with this source code in the file LICENSE.
*/

namespace Sulu\Bundle\ContentBundle\Content\Application\ContentResolver;
namespace Sulu\Bundle\ContentBundle\Content\Application\ContentAggregator;

use Sulu\Bundle\ContentBundle\Content\Application\ContentMerger\ContentMergerInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Exception\ContentNotFoundException;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Repository\DimensionContentRepositoryInterface;

class ContentResolver implements ContentResolverInterface
class ContentAggregator implements ContentAggregatorInterface
{
/**
* @var DimensionContentRepositoryInterface
Expand All @@ -39,7 +39,7 @@ public function __construct(
$this->contentMerger = $contentMerger;
}

public function resolve(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): DimensionContentInterface
public function aggregate(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): DimensionContentInterface
{
$dimensionContentCollection = $this->dimensionContentRepository->load($contentRichEntity, $dimensionAttributes);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
* with this source code in the file LICENSE.
*/

namespace Sulu\Bundle\ContentBundle\Content\Application\ContentResolver;
namespace Sulu\Bundle\ContentBundle\Content\Application\ContentAggregator;

use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentInterface;

interface ContentResolverInterface
interface ContentAggregatorInterface
{
/**
* @template T of DimensionContentInterface
Expand All @@ -26,5 +26,5 @@ interface ContentResolverInterface
*
* @return T
*/
public function resolve(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): DimensionContentInterface;
public function aggregate(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): DimensionContentInterface;
}
12 changes: 6 additions & 6 deletions Content/Application/ContentCopier/ContentCopier.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@

namespace Sulu\Bundle\ContentBundle\Content\Application\ContentCopier;

use Sulu\Bundle\ContentBundle\Content\Application\ContentAggregator\ContentAggregatorInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentMerger\ContentMergerInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentNormalizer\ContentNormalizerInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentPersister\ContentPersisterInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentResolver\ContentResolverInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentCollectionInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentInterface;

class ContentCopier implements ContentCopierInterface
{
/**
* @var ContentResolverInterface
* @var ContentAggregatorInterface
*/
private $contentResolver;
private $contentAggregator;

/**
* @var ContentMergerInterface
Expand All @@ -44,12 +44,12 @@ class ContentCopier implements ContentCopierInterface
private $contentNormalizer;

public function __construct(
ContentResolverInterface $contentResolver,
ContentAggregatorInterface $contentAggregator,
ContentMergerInterface $contentMerger,
ContentPersisterInterface $contentPersister,
ContentNormalizerInterface $contentNormalizer
) {
$this->contentResolver = $contentResolver;
$this->contentAggregator = $contentAggregator;
$this->contentMerger = $contentMerger;
$this->contentPersister = $contentPersister;
$this->contentNormalizer = $contentNormalizer;
Expand All @@ -62,7 +62,7 @@ public function copy(
array $targetDimensionAttributes,
array $options = []
): DimensionContentInterface {
$sourceDimensionContent = $this->contentResolver->resolve($sourceContentRichEntity, $sourceDimensionAttributes);
$sourceDimensionContent = $this->contentAggregator->aggregate($sourceContentRichEntity, $sourceDimensionAttributes);

return $this->copyFromDimensionContent($sourceDimensionContent, $targetContentRichEntity, $targetDimensionAttributes, $options);
}
Expand Down
12 changes: 6 additions & 6 deletions Content/Application/ContentIndexer/ContentIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Massive\Bundle\SearchBundle\Search\QueryHit;
use Massive\Bundle\SearchBundle\Search\SearchManager;
use Massive\Bundle\SearchBundle\Search\SearchManagerInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentResolver\ContentResolverInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentAggregator\ContentAggregatorInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Exception\ContentNotFoundException;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentInterface;
Expand All @@ -29,17 +29,17 @@ class ContentIndexer implements ContentIndexerInterface
private $searchManager;

/**
* @var ContentResolverInterface
* @var ContentAggregatorInterface
*/
private $contentResolver;
private $contentAggregator;

/**
* @param SearchManager $searchManager
*/
public function __construct(SearchManagerInterface $searchManager, ContentResolverInterface $contentResolver)
public function __construct(SearchManagerInterface $searchManager, ContentAggregatorInterface $contentAggregator)
{
$this->searchManager = $searchManager;
$this->contentResolver = $contentResolver;
$this->contentAggregator = $contentAggregator;
}

public function index(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): DimensionContentInterface
Expand Down Expand Up @@ -109,7 +109,7 @@ private function loadDimensionContent(
throw new ContentNotFoundException($contentRichEntity, $dimensionAttributes);
}

$dimensionContent = $this->contentResolver->resolve($contentRichEntity, $dimensionAttributes);
$dimensionContent = $this->contentAggregator->aggregate($contentRichEntity, $dimensionAttributes);

if ($locale !== $dimensionContent->getLocale()
|| $stage !== $dimensionContent->getStage()) {
Expand Down
12 changes: 6 additions & 6 deletions Content/Application/ContentManager/ContentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@

namespace Sulu\Bundle\ContentBundle\Content\Application\ContentManager;

use Sulu\Bundle\ContentBundle\Content\Application\ContentAggregator\ContentAggregatorInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentCopier\ContentCopierInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentIndexer\ContentIndexerInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentNormalizer\ContentNormalizerInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentPersister\ContentPersisterInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentResolver\ContentResolverInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentWorkflow\ContentWorkflowInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentInterface;

class ContentManager implements ContentManagerInterface
{
/**
* @var ContentResolverInterface
* @var ContentAggregatorInterface
*/
private $contentResolver;
private $contentAggregator;

/**
* @var ContentPersisterInterface
Expand Down Expand Up @@ -55,14 +55,14 @@ class ContentManager implements ContentManagerInterface
private $contentIndexer;

public function __construct(
ContentResolverInterface $contentResolver,
ContentAggregatorInterface $contentAggregator,
ContentPersisterInterface $contentPersister,
ContentNormalizerInterface $contentNormalizer,
ContentCopierInterface $contentCopier,
ContentWorkflowInterface $contentWorkflow,
ContentIndexerInterface $contentIndexer
) {
$this->contentResolver = $contentResolver;
$this->contentAggregator = $contentAggregator;
$this->contentPersister = $contentPersister;
$this->contentNormalizer = $contentNormalizer;
$this->contentCopier = $contentCopier;
Expand All @@ -72,7 +72,7 @@ public function __construct(

public function resolve(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): DimensionContentInterface
{
return $this->contentResolver->resolve($contentRichEntity, $dimensionAttributes);
return $this->contentAggregator->aggregate($contentRichEntity, $dimensionAttributes);
}

public function persist(ContentRichEntityInterface $contentRichEntity, array $data, array $dimensionAttributes): DimensionContentInterface
Expand Down
12 changes: 6 additions & 6 deletions Content/Infrastructure/Sulu/Preview/ContentObjectProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\NoResultException;
use Sulu\Bundle\ContentBundle\Content\Application\ContentAggregator\ContentAggregatorInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentDataMapper\ContentDataMapperInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentResolver\ContentResolverInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Exception\ContentNotFoundException;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentInterface;
Expand All @@ -36,9 +36,9 @@ class ContentObjectProvider implements PreviewObjectProviderInterface
private $entityManager;

/**
* @var ContentResolverInterface
* @var ContentAggregatorInterface
*/
private $contentResolver;
private $contentAggregator;

/**
* @var ContentDataMapperInterface
Expand All @@ -60,13 +60,13 @@ class ContentObjectProvider implements PreviewObjectProviderInterface
*/
public function __construct(
EntityManagerInterface $entityManager,
ContentResolverInterface $contentResolver,
ContentAggregatorInterface $contentAggregator,
ContentDataMapperInterface $contentDataMapper,
string $contentRichEntityClass,
?string $securityContext = null
) {
$this->entityManager = $entityManager;
$this->contentResolver = $contentResolver;
$this->contentAggregator = $contentAggregator;
$this->contentDataMapper = $contentDataMapper;
$this->contentRichEntityClass = $contentRichEntityClass;
$this->securityContext = $securityContext;
Expand Down Expand Up @@ -186,7 +186,7 @@ public function getSecurityContext($id, $locale): ?string
protected function resolveContent(ContentRichEntityInterface $contentRichEntity, string $locale): ?DimensionContentInterface
{
try {
$resolvedDimensionContent = $this->contentResolver->resolve(
$resolvedDimensionContent = $this->contentAggregator->aggregate(
$contentRichEntity,
[
'locale' => $locale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\NoResultException;
use Sulu\Bundle\ContentBundle\Content\Application\ContentResolver\ContentResolverInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentAggregator\ContentAggregatorInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Exception\ContentNotFoundException;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentInterface;
Expand All @@ -34,9 +34,9 @@ class ContentRouteDefaultsProvider implements RouteDefaultsProviderInterface
protected $entityManager;

/**
* @var ContentResolverInterface
* @var ContentAggregatorInterface
*/
protected $contentResolver;
protected $contentAggregator;

/**
* @var ContentStructureBridgeFactory
Expand All @@ -50,12 +50,12 @@ class ContentRouteDefaultsProvider implements RouteDefaultsProviderInterface

public function __construct(
EntityManagerInterface $entityManager,
ContentResolverInterface $contentResolver,
ContentAggregatorInterface $contentAggregator,
ContentStructureBridgeFactory $contentStructureBridgeFactory,
CacheLifetimeResolverInterface $cacheLifetimeResolver
) {
$this->entityManager = $entityManager;
$this->contentResolver = $contentResolver;
$this->contentAggregator = $contentAggregator;
$this->contentStructureBridgeFactory = $contentStructureBridgeFactory;
$this->cacheLifetimeResolver = $cacheLifetimeResolver;
}
Expand Down Expand Up @@ -147,7 +147,7 @@ protected function loadEntity(string $entityClass, string $id, string $locale):
// to support other dimension attributes here
// we should maybe get dimension Attributes from request attributes set by a request listener
// e.g. $request->attributes->get('_sulu_content_dimension_attributes');
$resolvedDimensionContent = $this->contentResolver->resolve(
$resolvedDimensionContent = $this->contentAggregator->aggregate(
$contentRichEntity,
[
'locale' => $locale,
Expand Down
12 changes: 6 additions & 6 deletions Content/Infrastructure/Sulu/Search/ContentReindexProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

use Doctrine\ORM\EntityManagerInterface;
use Massive\Bundle\SearchBundle\Search\Reindex\LocalizedReindexProviderInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentAggregator\ContentAggregatorInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentMetadataInspector\ContentMetadataInspectorInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentResolver\ContentResolverInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Exception\ContentNotFoundException;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentInterface;
Expand All @@ -40,9 +40,9 @@ class ContentReindexProvider implements LocalizedReindexProviderInterface
private $contentMetadataInspector;

/**
* @var ContentResolverInterface
* @var ContentAggregatorInterface
*/
private $contentResolver;
private $contentAggregator;

/**
* @var string
Expand All @@ -65,13 +65,13 @@ class ContentReindexProvider implements LocalizedReindexProviderInterface
public function __construct(
EntityManagerInterface $entityManager,
ContentMetadataInspectorInterface $contentMetadataInspector,
ContentResolverInterface $contentResolver,
ContentAggregatorInterface $contentAggregator,
string $context,
string $contentRichEntityClass
) {
$this->entityManager = $entityManager;
$this->contentMetadataInspector = $contentMetadataInspector;
$this->contentResolver = $contentResolver;
$this->contentAggregator = $contentAggregator;
$this->context = $context;
$this->contentRichEntityClass = $contentRichEntityClass;
}
Expand Down Expand Up @@ -151,7 +151,7 @@ public function translateObject($object, $locale)
$stage = $this->getWorkflowStage();

try {
$dimensionContent = $this->contentResolver->resolve(
$dimensionContent = $this->contentAggregator->aggregate(
$object,
[
'locale' => $locale,
Expand Down
12 changes: 6 additions & 6 deletions Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<!-- Route Defaults Provider -->
<service id="sulu_content.route_defaults_provider" class="Sulu\Bundle\ContentBundle\Content\Infrastructure\Sulu\Route\ContentRouteDefaultsProvider">
<argument type="service" id="doctrine.orm.entity_manager"/>
<argument type="service" id="sulu_content.content_resolver"/>
<argument type="service" id="sulu_content.content_aggregator"/>
<argument type="service" id="sulu_content.content_structure_bridge_factory"/>
<argument type="service" id="sulu_http_cache.cache_lifetime.resolver"/>

Expand All @@ -119,12 +119,12 @@
<service id="Sulu\Bundle\ContentBundle\Content\Application\ContentPersister\ContentPersisterInterface" alias="sulu_content.content_persister"/>

<!-- Content Loader -->
<service id="sulu_content.content_resolver" class="Sulu\Bundle\ContentBundle\Content\Application\ContentResolver\ContentResolver">
<service id="sulu_content.content_aggregator" class="Sulu\Bundle\ContentBundle\Content\Application\ContentAggregator\ContentAggregator">
<argument type="service" id="sulu_content.dimension_content_repository"/>
<argument type="service" id="sulu_content.content_merger"/>
</service>

<service id="Sulu\Bundle\ContentBundle\Content\Application\ContentResolver\ContentResolverInterface" alias="sulu_content.content_resolver"/>
<service id="Sulu\Bundle\ContentBundle\Content\Application\ContentAggregator\ContentAggregatorInterface" alias="sulu_content.content_aggregator"/>

<!-- ContentNormalizer -->
<service id="sulu_content.content_normalizer" class="Sulu\Bundle\ContentBundle\Content\Application\ContentNormalizer\ContentNormalizer">
Expand All @@ -135,7 +135,7 @@

<!-- Content Copier -->
<service id="sulu_content.content_copier" class="Sulu\Bundle\ContentBundle\Content\Application\ContentCopier\ContentCopier">
<argument type="service" id="sulu_content.content_resolver"/>
<argument type="service" id="sulu_content.content_aggregator"/>
<argument type="service" id="sulu_content.content_merger"/>
<argument type="service" id="sulu_content.content_persister"/>
<argument type="service" id="sulu_content.content_normalizer"/>
Expand All @@ -146,7 +146,7 @@
<!-- Content Indexer -->
<service id="sulu_content.content_indexer" class="Sulu\Bundle\ContentBundle\Content\Application\ContentIndexer\ContentIndexer">
<argument type="service" id="massive_search.search_manager"/>
<argument type="service" id="sulu_content.content_resolver"/>
<argument type="service" id="sulu_content.content_aggregator"/>
</service>

<service id="Sulu\Bundle\ContentBundle\Content\Application\ContentIndexer\ContentIndexerInterface" alias="sulu_content.content_indexer"/>
Expand Down Expand Up @@ -182,7 +182,7 @@

<!-- Content Manager -->
<service id="sulu_content.content_manager" class="Sulu\Bundle\ContentBundle\Content\Application\ContentManager\ContentManager">
<argument type="service" id="sulu_content.content_resolver"/>
<argument type="service" id="sulu_content.content_aggregator"/>
<argument type="service" id="sulu_content.content_persister"/>
<argument type="service" id="sulu_content.content_normalizer"/>
<argument type="service" id="sulu_content.content_copier"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ services:
arguments:
- '@doctrine.orm.entity_manager'
- '@sulu_content.content_metadata_inspector'
- '@sulu_content.content_resolver'
- '@sulu_content.content_aggregator'
- '%sulu.context%'
- Sulu\Bundle\ContentBundle\Tests\Application\ExampleTestBundle\Entity\Example
tags:
Expand All @@ -120,7 +120,7 @@ services:
class: Sulu\Bundle\ContentBundle\Content\Infrastructure\Sulu\Preview\ContentObjectProvider
arguments:
- '@doctrine.orm.entity_manager'
- '@sulu_content.content_resolver'
- '@sulu_content.content_aggregator'
- '@sulu_content.content_data_mapper'
- Sulu\Bundle\ContentBundle\Tests\Application\ExampleTestBundle\Entity\Example
tags:
Expand Down
Loading
Loading