Skip to content

Commit

Permalink
Rename ContentViewInterface to ContentProjectionInterface (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz authored and wachterjohannes committed Dec 17, 2019
1 parent 3e42667 commit 5ded1e6
Show file tree
Hide file tree
Showing 54 changed files with 528 additions and 528 deletions.
28 changes: 14 additions & 14 deletions Content/Application/ContentCopier/ContentCopier.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
use Sulu\Bundle\ContentBundle\Content\Application\ContentLoader\ContentLoaderInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentPersister\ContentPersisterInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ViewResolver\ApiViewResolverInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Factory\ViewFactoryInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Factory\ContentProjectionFactoryInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentProjectionInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentViewInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentCollectionInterface;

class ContentCopier implements ContentCopierInterface
Expand All @@ -29,7 +29,7 @@ class ContentCopier implements ContentCopierInterface
private $contentLoader;

/**
* @var ViewFactoryInterface
* @var ContentProjectionFactoryInterface
*/
private $viewFactory;

Expand All @@ -45,7 +45,7 @@ class ContentCopier implements ContentCopierInterface

public function __construct(
ContentLoaderInterface $contentLoader,
ViewFactoryInterface $viewFactory,
ContentProjectionFactoryInterface $viewFactory,
ContentPersisterInterface $contentPersister,
ApiViewResolverInterface $contentResolver
) {
Expand All @@ -60,28 +60,28 @@ public function copy(
array $sourceDimensionAttributes,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes
): ContentViewInterface {
$sourceContentView = $this->contentLoader->load($sourceContentRichEntity, $sourceDimensionAttributes);
): ContentProjectionInterface {
$sourceContentProjection = $this->contentLoader->load($sourceContentRichEntity, $sourceDimensionAttributes);

return $this->copyFromContentView($sourceContentView, $targetContentRichEntity, $targetDimensionAttributes);
return $this->copyFromContentProjection($sourceContentProjection, $targetContentRichEntity, $targetDimensionAttributes);
}

public function copyFromDimensionContentCollection(
DimensionContentCollectionInterface $dimensionContentCollection,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes
): ContentViewInterface {
$sourceContentView = $this->viewFactory->create($dimensionContentCollection);
): ContentProjectionInterface {
$sourceContentProjection = $this->viewFactory->create($dimensionContentCollection);

return $this->copyFromContentView($sourceContentView, $targetContentRichEntity, $targetDimensionAttributes);
return $this->copyFromContentProjection($sourceContentProjection, $targetContentRichEntity, $targetDimensionAttributes);
}

public function copyFromContentView(
ContentViewInterface $sourceContentView,
public function copyFromContentProjection(
ContentProjectionInterface $sourceContentProjection,
ContentRichEntityInterface $targetContentRichENtity,
array $targetDimensionAttributes
): ContentViewInterface {
$data = $this->contentResolver->resolve($sourceContentView);
): ContentProjectionInterface {
$data = $this->contentResolver->resolve($sourceContentProjection);

return $this->contentPersister->persist($targetContentRichENtity, $data, $targetDimensionAttributes);
}
Expand Down
12 changes: 6 additions & 6 deletions Content/Application/ContentCopier/ContentCopierInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

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

use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentProjectionInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentViewInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentCollectionInterface;

interface ContentCopierInterface
Expand All @@ -28,7 +28,7 @@ public function copy(
array $sourceDimensionAttributes,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes
): ContentViewInterface;
): ContentProjectionInterface;

/**
* @param mixed[] $targetDimensionAttributes
Expand All @@ -37,14 +37,14 @@ public function copyFromDimensionContentCollection(
DimensionContentCollectionInterface $dimensionContentCollection,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes
): ContentViewInterface;
): ContentProjectionInterface;

/**
* @param mixed[] $targetDimensionAttributes
*/
public function copyFromContentView(
ContentViewInterface $sourceContentView,
public function copyFromContentProjection(
ContentProjectionInterface $sourceContentProjection,
ContentRichEntityInterface $targetContentRichENtity,
array $targetDimensionAttributes
): ContentViewInterface;
): ContentProjectionInterface;
}
14 changes: 7 additions & 7 deletions Content/Application/ContentFacade/ContentFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
use Sulu\Bundle\ContentBundle\Content\Application\ContentPersister\ContentPersisterInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentWorkflow\ContentWorkflowInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ViewResolver\ApiViewResolverInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentProjectionInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentViewInterface;

class ContentFacade implements ContentFacadeInterface
{
Expand Down Expand Up @@ -62,27 +62,27 @@ public function __construct(
$this->contentWorkflow = $contentWorkflow;
}

public function load(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): ContentViewInterface
public function load(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): ContentProjectionInterface
{
return $this->contentLoader->load($contentRichEntity, $dimensionAttributes);
}

public function persist(ContentRichEntityInterface $contentRichEntity, array $data, array $dimensionAttributes): ContentViewInterface
public function persist(ContentRichEntityInterface $contentRichEntity, array $data, array $dimensionAttributes): ContentProjectionInterface
{
return $this->contentPersister->persist($contentRichEntity, $data, $dimensionAttributes);
}

public function resolve(ContentViewInterface $contentView): array
public function resolve(ContentProjectionInterface $contentProjection): array
{
return $this->contentResolver->resolve($contentView);
return $this->contentResolver->resolve($contentProjection);
}

public function copy(
ContentRichEntityInterface $sourceContentRichEntity,
array $sourceDimensionAttributes,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes
): ContentViewInterface {
): ContentProjectionInterface {
return $this->contentCopier->copy(
$sourceContentRichEntity,
$sourceDimensionAttributes,
Expand All @@ -95,7 +95,7 @@ public function applyTransition(
ContentRichEntityInterface $contentRichEntity,
array $dimensionAttributes,
string $transitionName
): ContentViewInterface {
): ContentProjectionInterface {
return $this->contentWorkflow->apply($contentRichEntity, $dimensionAttributes, $transitionName);
}
}
12 changes: 6 additions & 6 deletions Content/Application/ContentFacade/ContentFacadeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@

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

use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentProjectionInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentViewInterface;

interface ContentFacadeInterface
{
/**
* @param mixed[] $dimensionAttributes
*/
public function load(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): ContentViewInterface;
public function load(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): ContentProjectionInterface;

/**
* @param mixed[] $data
* @param mixed[] $dimensionAttributes
*/
public function persist(ContentRichEntityInterface $contentRichEntity, array $data, array $dimensionAttributes): ContentViewInterface;
public function persist(ContentRichEntityInterface $contentRichEntity, array $data, array $dimensionAttributes): ContentProjectionInterface;

/**
* @return mixed[]
*/
public function resolve(ContentViewInterface $contentView): array;
public function resolve(ContentProjectionInterface $contentProjection): array;

/**
* @param mixed[] $sourceDimensionAttributes
Expand All @@ -43,7 +43,7 @@ public function copy(
array $sourceDimensionAttributes,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes
): ContentViewInterface;
): ContentProjectionInterface;

/**
* @param mixed[] $dimensionAttributes
Expand All @@ -52,5 +52,5 @@ public function applyTransition(
ContentRichEntityInterface $contentRichEntity,
array $dimensionAttributes,
string $transitionName
): ContentViewInterface;
): ContentProjectionInterface;
}
10 changes: 5 additions & 5 deletions Content/Application/ContentLoader/ContentLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
namespace Sulu\Bundle\ContentBundle\Content\Application\ContentLoader;

use Sulu\Bundle\ContentBundle\Content\Domain\Exception\ContentNotFoundException;
use Sulu\Bundle\ContentBundle\Content\Domain\Factory\ViewFactoryInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Factory\ContentProjectionFactoryInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentProjectionInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentViewInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Repository\DimensionContentRepositoryInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Repository\DimensionRepositoryInterface;

Expand All @@ -33,21 +33,21 @@ class ContentLoader implements ContentLoaderInterface
private $dimensionContentRepository;

/**
* @var ViewFactoryInterface
* @var ContentProjectionFactoryInterface
*/
private $viewFactory;

public function __construct(
DimensionRepositoryInterface $dimensionRepository,
DimensionContentRepositoryInterface $dimensionContentRepository,
ViewFactoryInterface $viewFactory
ContentProjectionFactoryInterface $viewFactory
) {
$this->dimensionRepository = $dimensionRepository;
$this->dimensionContentRepository = $dimensionContentRepository;
$this->viewFactory = $viewFactory;
}

public function load(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): ContentViewInterface
public function load(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): ContentProjectionInterface
{
$dimensionCollection = $this->dimensionRepository->findByAttributes($dimensionAttributes);

Expand Down
4 changes: 2 additions & 2 deletions Content/Application/ContentLoader/ContentLoaderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

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

use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentProjectionInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentViewInterface;

interface ContentLoaderInterface
{
/**
* @param mixed[] $dimensionAttributes
*/
public function load(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): ContentViewInterface;
public function load(ContentRichEntityInterface $contentRichEntity, array $dimensionAttributes): ContentProjectionInterface;
}
10 changes: 5 additions & 5 deletions Content/Application/ContentPersister/ContentPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

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

use Sulu\Bundle\ContentBundle\Content\Domain\Factory\ContentProjectionFactoryInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Factory\DimensionCollectionFactoryInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Factory\DimensionContentCollectionFactoryInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Factory\ViewFactoryInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentProjectionInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentViewInterface;

class ContentPersister implements ContentPersisterInterface
{
Expand All @@ -32,21 +32,21 @@ class ContentPersister implements ContentPersisterInterface
private $dimensionContentCollectionFactory;

/**
* @var ViewFactoryInterface
* @var ContentProjectionFactoryInterface
*/
private $viewFactory;

public function __construct(
DimensionCollectionFactoryInterface $dimensionCollectionFactory,
DimensionContentCollectionFactoryInterface $dimensionContentCollectionFactory,
ViewFactoryInterface $viewFactory
ContentProjectionFactoryInterface $viewFactory
) {
$this->dimensionCollectionFactory = $dimensionCollectionFactory;
$this->dimensionContentCollectionFactory = $dimensionContentCollectionFactory;
$this->viewFactory = $viewFactory;
}

public function persist(ContentRichEntityInterface $contentRichEntity, array $data, array $dimensionAttributes): ContentViewInterface
public function persist(ContentRichEntityInterface $contentRichEntity, array $data, array $dimensionAttributes): ContentProjectionInterface
{
$dimensionCollection = $this->dimensionCollectionFactory->create($dimensionAttributes);
$dimensionContentCollection = $this->dimensionContentCollectionFactory->create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

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

use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentProjectionInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentViewInterface;

interface ContentPersisterInterface
{
/**
* @param mixed[] $data
* @param mixed[] $dimensionAttributes
*/
public function persist(ContentRichEntityInterface $contentRichEntity, array $data, array $dimensionAttributes): ContentViewInterface;
public function persist(ContentRichEntityInterface $contentRichEntity, array $data, array $dimensionAttributes): ContentProjectionInterface;
}
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\ViewFactory;
namespace Sulu\Bundle\ContentBundle\Content\Application\ContentProjectionFactory;

use Sulu\Bundle\ContentBundle\Content\Application\ViewFactory\Merger\MergerInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Factory\ViewFactoryInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentViewInterface;
use Sulu\Bundle\ContentBundle\Content\Application\ContentProjectionFactory\Merger\MergerInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Factory\ContentProjectionFactoryInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentProjectionInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentCollectionInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionContentInterface;

class ViewFactory implements ViewFactoryInterface
class ContentProjectionFactory implements ContentProjectionFactoryInterface
{
/**
* @var iterable<MergerInterface>
Expand All @@ -34,7 +34,7 @@ public function __construct(iterable $mergers)
$this->mergers = $mergers;
}

public function create(DimensionContentCollectionInterface $dimensionContentCollection): ContentViewInterface
public function create(DimensionContentCollectionInterface $dimensionContentCollection): ContentProjectionInterface
{
if (!$dimensionContentCollection->count()) {
throw new \RuntimeException('Expected at least one dimensionContent given.');
Expand All @@ -44,15 +44,15 @@ public function create(DimensionContentCollectionInterface $dimensionContentColl
$dimensionContentCollectionArray = iterator_to_array($dimensionContentCollection);
$lastKey = \count($dimensionContentCollectionArray) - 1;

$contentView = $dimensionContentCollectionArray[$lastKey]->createViewInstance();
$contentProjection = $dimensionContentCollectionArray[$lastKey]->createViewInstance();

foreach ($dimensionContentCollection as $dimensionContent) {
/** @var MergerInterface $merger */
foreach ($this->mergers as $merger) {
$merger->merge($contentView, $dimensionContent);
$merger->merge($contentProjection, $dimensionContent);
}
}

return $contentView;
return $contentProjection;
}
}
Loading

0 comments on commit 5ded1e6

Please sign in to comment.