Skip to content
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

Implement CacheLifetimeBehaviourInterface in ArticleBridge #621

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions Document/Structure/ArticleBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Own structure bridge for articles.
*/
class ArticleBridge extends StructureBridge
class ArticleBridge extends StructureBridge implements RoutableStructureInterface
{
/**
* @var string
Expand All @@ -30,7 +30,29 @@ class ArticleBridge extends StructureBridge

public function getView(): string
{
return $this->structure->getView();
/** @var string $view */
$view = $this->structure->getView();

return $view;
luca-rath marked this conversation as resolved.
Show resolved Hide resolved
}

public function getController(): string
{
/** @var string $controller */
$controller = $this->structure->getController();

return $controller;
luca-rath marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* @return array{type: string, value: string}
*/
public function getCacheLifeTime(): array
{
/** @var array{type: string, value: string} $cacheLifetime */
$cacheLifetime = $this->structure->getCacheLifetime();

return $cacheLifetime;
luca-rath marked this conversation as resolved.
Show resolved Hide resolved
}

public function getUuid()
Expand Down
61 changes: 61 additions & 0 deletions Document/Structure/RoutableStructureInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?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\ArticleBundle\Document\Structure;

use Sulu\Component\Content\Compat\RoutableStructureInterface as SuluRoutableStructureInterface;

if (\interface_exists(SuluRoutableStructureInterface::class)) {
/**
* @deprecated will be removed, as soon as the ArticleBundle rises the minimum requirement of sulu to a version,
* where this interface exists
*
* @internal
*/
interface RoutableStructureInterface extends SuluRoutableStructureInterface
{
}
} else {
/**
* @deprecated will be removed, as soon as the ArticleBundle rises the minimum requirement of sulu to a version,
* where this interface exists
*
* @internal
*/
interface RoutableStructureInterface
{
/**
* twig template of template definition.
*
* @return string
*/
public function getView();

/**
* controller which renders the twig template.
*
* @return string
*/
public function getController();

/**
* cacheLifeTime of template definition.
*
* @return array{
* type: string,
* value: string,
* }
*/
public function getCacheLifeTime();
}
}
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1525,11 +1525,6 @@ parameters:
count: 1
path: Document/Structure/ArticleBridge.php

-
message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Document\\\\Structure\\\\ArticleBridge\\:\\:getView\\(\\) should return string but returns string\\|null\\.$#"
count: 1
path: Document/Structure/ArticleBridge.php

-
message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Document\\\\Structure\\\\ArticleBridge\\:\\:setUuid\\(\\) has no return type specified\\.$#"
count: 1
Expand Down