-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add shadow functionality to publishing process #243
Add shadow functionality to publishing process #243
Conversation
e8a891f
to
9412ac3
Compare
Pull Request Test Coverage Report for Build 4525650416
💛 - Coveralls |
9412ac3
to
869cabb
Compare
@@ -60,6 +60,18 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $event): void | |||
$this->addIndex($metadata, 'idx_stage', ['stage']); | |||
} | |||
|
|||
if ($reflection->implementsInterface(ShadowInterface::class)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just moved this to change the ordering of the columns as I think it make sense to have this columns visible first in the database table view before seo, excerpt, ...
foreach ($views as $view) { | ||
if ($view instanceof PreviewFormViewBuilderInterface) { | ||
$view->setPreviewCondition('shadowOn != true'); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quickfix as the preview currently can not handle shadow feature.
60e7c7f
to
7f12e26
Compare
02a164e
to
5d114ba
Compare
5a8882c
to
f6eefd9
Compare
f6eefd9
to
7a32a03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it is a very individual test case with different tests depending on each other I thought it most make sense to have it in an own class
array $data = [], | ||
array $ignoredAttributes = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While looking now again on this maybe put this together in an array $options
so this interface don't is so messed up and more future proof. What do you think @Prokyonn @wachterjohannes
$contentCopier->copy(
$contentRichEntity,
$sourceDimensionAttributes,
$contentRichEntity,
$targetDimensionAttributes,
options: [
'data': [
'shadowOn' => true,
'shadowLocale' => 'de',
'url' => '/test-de',
],
'ignoredAttributes': [
// ...
],
]
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds okfor me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also prefer the options
parameter, the interface would be cleaner and with correct php doctypes the developer gets the same information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me the code Looks good 👍 if you want to refactor the additional arguments with options - do it! else it would be also OK for me like it is now
array $data = [], | ||
array $ignoredAttributes = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds okfor me 👍
@@ -26,14 +26,18 @@ interface ContentCopierInterface | |||
* @param mixed[] $sourceDimensionAttributes | |||
* @param ContentRichEntityInterface<T> $targetContentRichEntity | |||
* @param mixed[] $targetDimensionAttributes | |||
* @param mixed[] $data This data is merged with the data of the source content before set on the target content | |||
* @param string[] $ignoredAttributes This attributes stayed untouched |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param string[] $ignoredAttributes This attributes stayed untouched | |
* @param string[] $ignoredAttributes These attributes stay untouched |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this to a new $options parameter as written above do you want to recheck the comment there?
@@ -42,13 +46,17 @@ public function copy( | |||
* @param DimensionContentCollectionInterface<T> $dimensionContentCollection | |||
* @param ContentRichEntityInterface<T> $targetContentRichEntity | |||
* @param mixed[] $targetDimensionAttributes | |||
* @param mixed[] $data This data is merged with the data of the source content before set on the target content | |||
* @param string[] $ignoredAttributes This attributes stayed untouched |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param string[] $ignoredAttributes This attributes stayed untouched | |
* @param string[] $ignoredAttributes These attributes stay untouched |
@@ -57,12 +65,16 @@ public function copyFromDimensionContentCollection( | |||
* @param T $dimensionContent | |||
* @param ContentRichEntityInterface<T> $targetContentRichEntity | |||
* @param mixed[] $targetDimensionAttributes | |||
* @param mixed[] $data This data is merged with the data of the source content before set on the target content | |||
* @param string[] $ignoredAttributes This attributes stayed untouched |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param string[] $ignoredAttributes This attributes stayed untouched | |
* @param string[] $ignoredAttributes These attributes stay untouched |
$name = $property->getName(); | ||
|
||
// Float are converted to ints in php array as key so we need convert it to string | ||
if (\is_float($name)) { | ||
$name = (string) $name; | ||
} | ||
|
||
if (\array_key_exists($name, $data)) { | ||
$value = $property->isLocalized() ? $defaultLocalizedData[$name] ?? null : $defaultLocalizedData[$name] ?? null; | ||
if (\array_key_exists($name, $data)) { // values not explicitly given need to stay untouched for e.g. for shadow pages urls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (\array_key_exists($name, $data)) { // values not explicitly given need to stay untouched for e.g. for shadow pages urls | |
if (\array_key_exists($name, $data)) { // values not explicitly given need to stay untouched for e.g. shadow pages urls |
array $data = [], | ||
array $ignoredAttributes = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also prefer the options
parameter, the interface would be cleaner and with correct php doctypes the developer gets the same information
c39c0fa
to
fad544f
Compare
d88eec0
to
a430fbe
Compare
@@ -65,6 +65,7 @@ | |||
"thecodingmachine/phpstan-strict-rules": "^1.0" | |||
}, | |||
"conflict": { | |||
"coduo/php-matcher": "6.0.12", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conflict because of: coduo/php-matcher#463
This implements the shadowing behaviour like discussed with @chirimoya. The data of the
draft
page stays as it is and when publishing aShadow
page the content from the ShadowLocale will be copied to the published page.TODO Functional Tests
TODO Unit Tests