Skip to content
This repository has been archived by the owner on Aug 6, 2018. It is now read-only.

Installation

flojon edited this page Jan 26, 2013 · 4 revisions

Installation is handled through Composer. First make sure you have "minimum-stability": "dev" in your composer.json. Then execute this in your Symfony 2.1 project

composer require koala/mercury-content-bundle dev-master

Add the following bundles to your app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        ...
        new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
        new Symfony\Cmf\Bundle\RoutingExtraBundle\SymfonyCmfRoutingExtraBundle(),
        new Knp\Bundle\MenuBundle\KnpMenuBundle(),
        new Symfony\Cmf\Bundle\MenuBundle\SymfonyCmfMenuBundle(),
        new Symfony\Cmf\Bundle\ContentBundle\SymfonyCmfContentBundle(),
        new FOS\RestBundle\FOSRestBundle(),
        new JMS\SerializerBundle\JMSSerializerBundle($this),
        new Koala\Bundle\MercuryContentBundle\KoalaMercuryContentBundle(),
    );
    ...

Add the following line to app/autoload.php, right before the return statement

AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Mapping/Annotations/DoctrineAnnotations.php');

Add the following to your app/config/config.yml

# cmf configuration
doctrine_phpcr:
    # configure the PHPCR session
    session:
        backend: %phpcr_backend%
        workspace: %phpcr_workspace%
        username: %phpcr_user%
        password: %phpcr_pass%
    # enable the ODM layer
    odm:
        auto_mapping: true
        auto_generate_proxy_classes: %kernel.debug%
        locales:
            en:
                - en

symfony_cmf_routing_extra:
    chain:
        routers_by_id:
            symfony_cmf_routing_extra.dynamic_router: 20
            router.default: 100
    dynamic:
        enabled: true
        generic_controller: koala_mercury_content.controller:indexAction
        controllers_by_class:
            Symfony\Cmf\Bundle\RoutingExtraBundle\Document\RedirectRoute:  symfony_cmf_routing_extra.redirect_controller:redirectAction
            Koala\Bundle\MercuryContentBundle\Document\Content: koala_mercury_content.controller:indexAction

knp_menu:
    twig: true

sensio_framework_extra:
    view:    { annotations: false }
    router:  { annotations: true }
    request: { converters: true }

Make sure your database is setup and then add this to your app/config/parameters.yml

phpcr_backend:
    type: doctrinedbal
    connection: doctrine.dbal.default_connection
phpcr_workspace: default
phpcr_user: admin
phpcr_pass: admin

This configures the Doctrine DBAL provider. If you want to use Apache Jackrabbit see CMF Sandbox for setup instructions.

In app/config/routing.yml add this

koala_mercury_content:
    resource: "@KoalaMercuryContentBundle/Resources/config/routing.yml"
    prefix:   /

Make sure app/config/routing_dev.yml doesn't contain the default rule for welcome since it will take over the root URL.

Prepare the PHPCR repository

Create and initialize the database:

app/console doctrine:database:create
app/console doctrine:phpcr:init:dbal

Then register the system node types:

app/console doctrine:phpcr:register-system-node-types

Import the fixtures:

app/console doctrine:phpcr:fixtures:load

Run

Launch the webserver:

app/console server:run
Clone this wiki locally