-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename NormalizerHelper into NormalizeEnhancer
- Loading branch information
1 parent
c65a286
commit d820692
Showing
17 changed files
with
440 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Content/Application/ContentProjectionNormalizer/Enhancer/TemplateNormalizeEnhancer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of Sulu. | ||
* | ||
* (c) Sulu GmbH | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Sulu\Bundle\ContentBundle\Content\Application\ContentProjectionNormalizer\Enhancer; | ||
|
||
use Sulu\Bundle\ContentBundle\Content\Domain\Model\TemplateInterface; | ||
|
||
class TemplateNormalizeEnhancer implements NormalizeEnhancerInterface | ||
{ | ||
public function enhance(object $object, array $normalizeData): array | ||
{ | ||
if (!$object instanceof TemplateInterface) { | ||
return $normalizeData; | ||
} | ||
|
||
$normalizeData = array_merge($normalizeData, $normalizeData['templateData']); | ||
unset($normalizeData['templateData']); | ||
|
||
$normalizeData['template'] = $normalizeData['templateKey']; | ||
unset($normalizeData['templateKey']); | ||
|
||
return $normalizeData; | ||
} | ||
|
||
public function getIgnoredAttributes(object $object): array | ||
{ | ||
if (!$object instanceof TemplateInterface) { | ||
return []; | ||
} | ||
|
||
return [ | ||
'templateType', | ||
]; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
Content/Application/ContentProjectionNormalizer/Enhancer/WorkflowNormalizeEnhancer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of Sulu. | ||
* | ||
* (c) Sulu GmbH | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Sulu\Bundle\ContentBundle\Content\Application\ContentProjectionNormalizer\Enhancer; | ||
|
||
use Sulu\Bundle\ContentBundle\Content\Domain\Model\WorkflowInterface; | ||
|
||
class WorkflowNormalizeEnhancer implements NormalizeEnhancerInterface | ||
{ | ||
public function enhance(object $object, array $normalizeData): array | ||
{ | ||
if (!$object instanceof WorkflowInterface) { | ||
return $normalizeData; | ||
} | ||
|
||
$normalizeData['publishedState'] = WorkflowInterface::WORKFLOW_PLACE_PUBLISHED === $normalizeData['workflowPlace']; | ||
$normalizeData['published'] = $normalizeData['workflowPublished']; | ||
unset($normalizeData['workflowPublished']); | ||
|
||
return $normalizeData; | ||
} | ||
|
||
public function getIgnoredAttributes(object $object): array | ||
{ | ||
if (!$object instanceof WorkflowInterface) { | ||
return []; | ||
} | ||
|
||
return []; | ||
} | ||
} |
41 changes: 0 additions & 41 deletions
41
Content/Application/ContentProjectionNormalizer/Helper/TemplateNormalizerHelper.php
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
Content/Application/ContentProjectionNormalizer/Helper/WorkflowNormalizerHelper.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" ?> | ||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
<services> | ||
<!-- Enhancer --> | ||
<service id="sulu_content.excerpt_normalize_enhancer" class="Sulu\Bundle\ContentBundle\Content\Application\ContentProjectionNormalizer\Enhancer\ExcerptNormalizeEnhancer"> | ||
<tag name="sulu_content.normalize_enhancer"/> | ||
</service> | ||
|
||
<service id="sulu_content.template_normalize_enhancer" class="Sulu\Bundle\ContentBundle\Content\Application\ContentProjectionNormalizer\Enhancer\TemplateNormalizeEnhancer"> | ||
<tag name="sulu_content.normalize_enhancer"/> | ||
</service> | ||
|
||
<service id="sulu_content.workflow_normalize_enhancer" class="Sulu\Bundle\ContentBundle\Content\Application\ContentProjectionNormalizer\Enhancer\WorkflowNormalizeEnhancer"> | ||
<tag name="sulu_content.normalize_enhancer"/> | ||
</service> | ||
</services> | ||
</container> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.