Skip to content

Commit

Permalink
Add basic configuration for content bundle storage
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Mar 11, 2021
1 parent 37e9da7 commit 4508a9f
Show file tree
Hide file tree
Showing 16 changed files with 397 additions and 76 deletions.
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

0 comments on commit 4508a9f

Please sign in to comment.