Skip to content

Commit

Permalink
Fix article-bridge language-code (#644)
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes authored Aug 8, 2023
1 parent a591b2e commit b997e4f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Document/Structure/ArticleBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,18 @@ public function setWebspaceKey($webspace)
{
$this->webspaceKey = $webspace;
}

public function getLanguageCode()
{
if (!$this->document) {
return $this->locale;
}

// return original locale for shadow or ghost pages
if ($this->getIsShadow() || ($this->getType() && 'ghost' === $this->getType()->getName())) {
return $this->inspector->getOriginalLocale($this->getDocument());
}

return parent::getLanguageCode();
}
}
2 changes: 1 addition & 1 deletion SuluArticleBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class SuluArticleBundle extends Bundle
{
public function build(ContainerBuilder $container)
public function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new ConverterCompilerPass());
$container->addCompilerPass(new StructureValidatorCompilerPass(), PassConfig::TYPE_AFTER_REMOVING);
Expand Down
10 changes: 10 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,11 @@ parameters:
count: 1
path: Document/Structure/ArticleBridge.php

-
message: "#^Left side of && is always true\\.$#"
count: 1
path: Document/Structure/ArticleBridge.php

-
message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Document\\\\Structure\\\\ArticleBridge\\:\\:getConcreteLanguages\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -1485,6 +1490,11 @@ parameters:
count: 1
path: Document/Structure/ArticleBridge.php

-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
path: Document/Structure/ArticleBridge.php

-
message: "#^Parameter \\#1 \\$document of method Sulu\\\\Bundle\\\\DocumentManagerBundle\\\\Bridge\\\\DocumentInspector\\:\\:getConcreteLocales\\(\\) expects Sulu\\\\Component\\\\Content\\\\Document\\\\Behavior\\\\ShadowLocaleBehavior, object given\\.$#"
count: 1
Expand Down

0 comments on commit b997e4f

Please sign in to comment.