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 bdf1a69
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 7 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);

0 comments on commit bdf1a69

Please sign in to comment.