Skip to content

Commit

Permalink
Add deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
Prokyonn committed Dec 20, 2023
1 parent 9f84b43 commit 11b1b6f
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions Controller/ArticleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ public function __construct(
$this->securityChecker = $securityChecker;
$this->displayTabAll = $displayTabAll;
$this->documentInspector = $documentInspector;

if (null === $this->documentInspector) {
@trigger_deprecation('sulu/article-bundle', '2.5', 'Instantiating the ArticleController without the $documentInspector argument is deprecated!');
}
}

/**
Expand Down Expand Up @@ -427,17 +431,19 @@ public function getAction(Request $request, string $id): Response
$locale
);

$localizationState = $this->documentInspector->getLocalizationState($document);

if ($localizationState === LocalizationState::GHOST) {
$document = $this->documentManager->find(
$id,
$locale,
[
'load_ghost_content' => false,
'structure_type' => $document->getStructureType(),
]
);
if ($this->documentInspector) {
$localizationState = $this->documentInspector->getLocalizationState($document);

if ($localizationState === LocalizationState::GHOST) {
$document = $this->documentManager->find(
$id,
$locale,
[
'load_ghost_content' => false,
'structure_type' => $document->getStructureType(),

Check failure on line 443 in Controller/ArticleController.php

View workflow job for this annotation

GitHub Actions / PHP Lint

Call to an undefined method object::getStructureType().
]
);
}
}

$context = new Context();
Expand Down

0 comments on commit 11b1b6f

Please sign in to comment.