Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Latest commit

 

History

History
73 lines (57 loc) · 2.79 KB

README.md

File metadata and controls

73 lines (57 loc) · 2.79 KB

Sulu ExampleNewsBundle Tutorial

This is a step-by-step tutorial how to create an extension for Sulu. Each step is explained as a pull request against the previous step and with additional information in a blog-post on blog.sulu.io. It was built with the releases 1.1.* of Sulu.

Documentation

The master contains the whole code to run the example. The code foreach step comes in a single branch that build on the previous one. The first branch 00-symfony-bundle is a simple bundle-bootstrap which was generated by Symfony's generate:bundle command.

The steps are explained as pull requests, each building upon the previous branch and contains descriptions in form of comments and a link to the related blog-post.

Installation

To install the example use a fresh clone from sulu-standard and run following commands to clone this Repository into the right folder.

mkdir src/Example
cd src/Example
git clone https://github.com/sulu-io/ExampleNewsBundle.git NewsBundle

Apply following patch to enable and configure ExampleNewsBundle:

diff --git a/app/AbstractKernel.php b/app/AbstractKernel.php
index 8d149aa..e180d35 100644
--- a/app/AbstractKernel.php
+++ b/app/AbstractKernel.php
@@ -66,6 +66,8 @@ abstract class AbstractKernel extends SuluKernel
 
             // tools
             new Massive\Bundle\BuildBundle\MassiveBuildBundle(),
+
+            new Example\NewsBundle\ExampleNewsBundle(),
         ];
 
         if (in_array($this->getEnvironment(), ['dev', 'test'])) {
diff --git a/app/config/admin/routing.yml b/app/config/admin/routing.yml
index ae2ceb4..7047e47 100644
--- a/app/config/admin/routing.yml
+++ b/app/config/admin/routing.yml
@@ -88,3 +88,8 @@ client_website:
 sulu_search:
     resource: "@SuluSearchBundle/Resources/config/routing.yml"
     prefix: /admin/search
+
+example_news:
+    resource: "@ExampleNewsBundle/Resources/config/routing_api.xml"
+    type: rest
+    prefix: /admin/api

To build the translations follow the tutorial part 5.

At the end run following command to install assets of this bundle and update the database:

app/console assets:install --symlink --relative
app/console doctrine:schema:update --force

See also

  • Sulu - Source code of Sulu
  • Sulu documentation - Full documentation of Sulu
  • Sulu blog - Our developers publish periodically blog-posts
  • Sulu demo - The demo which represents the current releases
  • Sulu homepage - Introduction to Sulu and more information for decision makers