Skip to content

Commit

Permalink
Add required part about creating your documents (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz authored Feb 25, 2021
1 parent e8fcd48 commit e86aac4
Showing 1 changed file with 31 additions and 20 deletions.
51 changes: 31 additions & 20 deletions Resources/doc/article-view-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,37 @@ The `content` and `view` property is represented by a proxy to avoid resolving d
To extend the indexed data you can extend the `ArticleViewDocument`. This can be achieved by performing the following
steps. The same steps can also be used to extend the `ArticlePageViewObject`.

### 0. Create a Bundle Class

Unfortunately, the ElasticsearchBundle allows to overwrite document classes only if an `AppBundle` is registered in the
application. If you do not have registered such a bundle yet, you need to add it to your `src` directory and enable it
in the `config/bundles.php` file.

```php
<?php

// src/AppBundle.php

namespace App;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AppBundle extends Bundle
{
}
```

```php
<?php

// config/bundles.php

return [
// ...
\App\AppBundle::class => ['all' => true],
]
```

#### 1. Create custom class

```php
Expand Down Expand Up @@ -125,23 +156,3 @@ class ArticleIndexListener
<tag name="kernel.event_listener" event="sulu_article.index" method="onIndex"/>
</service>
```

### Troubleshooting

Unfortunately, the ElasticsearchBundle allows to overwrite document classes only if an `AppBundle` is registered in the
application. If you do not have registered such a bundle yet, you need to add it to your `src` directory and enable it
in the `config/bundles.php` file.

```
<?php
// src/AppBundle.php
namespace App;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AppBundle extends Bundle
{
}
```

0 comments on commit e86aac4

Please sign in to comment.