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

Add configuration for experimental content bundle storage #553

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 0 additions & 2 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
dependency-versions: 'highest'
php-extensions: 'ctype, iconv, mysql, imagick'
tools: 'composer:v2'
phpstan: true
lint: true
env:
SYMFONY_DEPRECATIONS_HELPER: weak
Expand All @@ -54,7 +53,6 @@ jobs:
dependency-versions: 'highest'
php-extensions: 'ctype, iconv, mysql, imagick'
tools: 'composer:v2'
phpstan: false
lint: false
env:
SYMFONY_DEPRECATIONS_HELPER: weak
Expand Down
39 changes: 39 additions & 0 deletions Article/Domain/Model/Article.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/*
* 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\Article\Domain\Model;

use Ramsey\Uuid\Uuid;
use Sulu\Component\Persistence\Model\AuditableTrait;

/**
* @experimental
*/
class Article implements ArticleInterface
{
use AuditableTrait;

/**
* @var string
*/
private $id;

public function __construct(
?string $id = null
) {
$this->id = $id ?: Uuid::uuid4()->toString();
}

public function getId(): string
{
return $this->id;
}
}
25 changes: 25 additions & 0 deletions Article/Domain/Model/ArticleInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

/*
* 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\Article\Domain\Model;

use Sulu\Component\Persistence\Model\AuditableInterface;

/**
* @experimental
*/
interface ArticleInterface extends AuditableInterface
{
public const TEMPLATE_TYPE = 'article';
public const RESOURCE_KEY = 'article';

public function getId(): string;
}
26 changes: 25 additions & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Sulu\Bundle\ArticleBundle\DependencyInjection;

use Sulu\Bundle\ArticleBundle\Article\Domain\Model\Article;
use Sulu\Bundle\ArticleBundle\Document\ArticlePageViewObject;
use Sulu\Bundle\ArticleBundle\Document\ArticleViewDocument;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
Expand All @@ -21,6 +22,9 @@
*/
class Configuration implements ConfigurationInterface
{
public const ARTICLE_STORAGE_PHPCR = 'phpcr';
public const ARTICLE_STORAGE_EXPERIMENTAL = 'experimental';

/**
* {@inheritdoc}
*/
Expand All @@ -31,7 +35,27 @@ public function getConfigTreeBuilder()

$rootNode
->children()
->scalarNode('index_name')->isRequired()->end()
->arrayNode('article')
->addDefaultsIfNotSet()
->children()
->enumNode('storage')
->values([self::ARTICLE_STORAGE_PHPCR, self::ARTICLE_STORAGE_EXPERIMENTAL])
->defaultValue(self::ARTICLE_STORAGE_PHPCR)
->end()
->arrayNode('objects')
->addDefaultsIfNotSet()
->children()
->arrayNode('article')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue(Article::class)->end()
->end()
->end()
->end()
->end()
->end()
->end()
->scalarNode('index_name')->end()
->arrayNode('hosts')
->prototype('scalar')->end()
->end()
Expand Down
Loading