Skip to content

Latest commit

 

History

History
133 lines (98 loc) · 2.67 KB

installation.md

File metadata and controls

133 lines (98 loc) · 2.67 KB

Installation

Install ElasticSearch

The sulu article bundle requires a running elasticsearch ^2.2.

Install bundle over composer:

composer require sulu/article-bundle

Add bundle to AbstractKernel:

/* app/AbstractKernel.php */

new Sulu\Bundle\ArticleBundle\SuluArticleBundle(),
new ONGR\ElasticsearchBundle\ONGRElasticsearchBundle(),

Configure the bundles:

# app/config/config.yml

sulu_route:
    mappings:
        Sulu\Bundle\ArticleBundle\Document\ArticleDocument:
            generator: schema
            options:
                route_schema: /articles/{object.getTitle()}

sulu_core:
    content:
        structure:
            default_type:
                article: "article_default"
            paths:
                article:
                    path: "%kernel.root_dir%/Resources/templates/articles"
                    type: "article"

ongr_elasticsearch:
    connections:
        default:
            index_name: su_articles
        live:
            index_name: su_articles_live
    managers:
        default:
            connection: default
            mappings:
                - SuluArticleBundle
        live:
            connection: live
            mappings:
                - SuluArticleBundle

Configure the routing

# app/config/admin/routing.yml

sulu_arictle_api:
    resource: "@SuluArticleBundle/Resources/config/routing_api.xml"
    type: rest
    prefix: /admin/api

sulu_article:
    resource: "@SuluArticleBundle/Resources/config/routing.xml"
    prefix: /admin/articles

Create Template

Add xml template for structure in configured folder:

%kernel.root_dir%/Resources/templates/articles/article_default.xml

Example is located in Bundle article_default.xml.

Add template for article type in configured folder: ``

%kernel.root_dir%/Resources/views/articles/article_default.html.twig

Example is located in Bundle article_default.xml.

Initialize bundle

Create assets:

php bin/console assets:install

Create required phpcr nodes:

php bin/console sulu:document:init

Create elasticsearch index:

php bin/console ongr:es:index:create

Possible bundle configurations:

# app/config/config.yml

sulu_article:
    documents:
        article:
            view: Sulu\Bundle\ArticleBundle\Document\ArticleViewDocument
    types:

        # Prototype
        name:
            translation_key:      ~

    # Display tab 'all' in list view
    display_tab_all:      true