Skip to content

Commit

Permalink
Add docs about experimental storage
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Mar 11, 2021
1 parent 4508a9f commit 35fde55
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 8 deletions.
13 changes: 6 additions & 7 deletions DependencyInjection/SuluArticleExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,14 @@ public function load(array $configs, ContainerBuilder $container)
$isPHPCRStorage = Configuration::ARTICLE_STORAGE_PHPCR === $storage;
$isExperimentalStorage = Configuration::ARTICLE_STORAGE_EXPERIMENTAL === $storage;

$container->setParameter('sulu_article.default_main_webspace', $config['default_main_webspace']);
$container->setParameter('sulu_article.default_additional_webspaces', $config['default_additional_webspaces']);
$container->setParameter('sulu_article.types', $config['types']);
$container->setParameter('sulu_article.display_tab_all', $config['display_tab_all']);
$container->setParameter('sulu_article.smart_content.default_limit', $config['smart_content']['default_limit']);
$container->setParameter('sulu_article.search_fields', $config['search_fields']);

if ($isPHPCRStorage) {
// can be removed when phpcr storage is removed
$container->setParameter('sulu_article.default_main_webspace', $config['default_main_webspace']);
$container->setParameter('sulu_article.default_additional_webspaces', $config['default_additional_webspaces']);
$container->setParameter('sulu_article.types', $config['types']);
$container->setParameter('sulu_article.display_tab_all', $config['display_tab_all']);
$container->setParameter('sulu_article.smart_content.default_limit', $config['smart_content']['default_limit']);
$container->setParameter('sulu_article.search_fields', $config['search_fields']);
$container->setParameter('sulu_article.documents', $config['documents']);
$container->setParameter('sulu_article.view_document.article.class', $config['documents']['article']['view']);
}
Expand Down
70 changes: 70 additions & 0 deletions Resources/doc/experimental-storage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Experimental Content Bundle Storage

For the **experimental** storage the articles are stored using the [SuluContentBundle](https://github.com/sulu/sulucontentbundle).

## Installation

To use the experimental storage you need to have the [SuluContentBundle](https://github.com/sulu/sulucontentbundle) installed.

```bash
composer require sulu/content-bundle
```

Then you can configure it:

```yaml
sulu_article:
article:
storage: experimental
```
## Configuration
The following is showing the full configuration of the **experimental** article module:
```yaml
sulu_product:
article:
storage: experimental

# optional
objects:
article:
model: 'Sulu\Bundle\ArticleBundle\Article\Domain\Model\Article'
```
## Override Entities
### Override Article Entity
```php
<?php
// src/Entity/Article.php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Sulu\Bundle\ArticleBundle\Product\Domain\Model\Article as SuluArticle;

/**
* @ORM\Table(name="ar_articles")
* @ORM\Entity
*/
class Article extends SuluArticle
{
}
```

Configure your new model class:

```yaml
# config/packages/sulu_article.yaml

sulu_article:
article:
objects:
article:
model: 'App\Entity\Article'
```
To add new fields to your entity have a look at the [Doctrine Mapping Documentation](https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/basic-mapping.html);
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"elasticsearch/elasticsearch": "^5.0 || ^6.0 || ^7.0",
"friendsofphp/php-cs-fixer": "^2.17",
"handcraftedinthealps/elasticsearch-bundle": "^5.2.6.4",
"handcraftedinthealps/elasticsearch-dsl": "^5.0.7.1 || ^6.2.0.1 || ^7.2.0.1",
"handcraftedinthealps/elasticsearch-dsl": "^6.2.0.1",
"handcraftedinthealps/zendsearch": "^2.0",
"jackalope/jackalope-doctrine-dbal": "^1.3.4",
"jackalope/jackalope-jackrabbit": "^1.3",
Expand All @@ -58,6 +58,11 @@
"symfony/stopwatch": "^4.3 || ^5.0",
"thecodingmachine/phpstan-strict-rules": "^0.12.0"
},
"conflict": {
"elasticsearch/elasticsearch": "<5.0 >=8.0",
"handcraftedinthealps/elasticsearch-bundle": "<5.2.6.4 >= 6.0",
"handcraftedinthealps/elasticsearch-dsl": "<5.0.7.1 || <6.2.0.1 || <7.2.0.1 >=8.0"
},
"suggest": {
"sulu/automation-bundle": "Allows to outsource long-running route update processes."
},
Expand Down

0 comments on commit 35fde55

Please sign in to comment.