Version

Documentation » Doctrine2 PHPCR Admin

2. Configuration »

« Doctrine PHPCR Admin Bundle

This Page

2. Configuration »

« Doctrine PHPCR Admin Bundle

1. Installation

SonataDoctrinePhpcrAdminBundle is part of a set of bundles aimed at abstracting storage connectivity for SonataAdminBundle. As such, SonataDoctrinePhpcrAdminBundle depends on SonataAdminBundle, and will not work without it.

Note

These installation instructions are meant to be used only as part of SonataAdminBundle’s installation process, which is documented here.

1.1. Download the Bundle

composer require sonata-project/doctrine-phpcr-admin-bundle

1.2. Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in bundles.php file of your project:

// config/bundles.php

return [
    // ...
    Symfony\Cmf\Bundle\TreeBrowserBundle\CmfTreeBrowserBundle::class => ['all' => true],
    Sonata\DoctrinePHPCRAdminBundle\SonataDoctrinePHPCRAdminBundle::class => ['all' => true],
];

1.3. Load Routing

  • YAML
    # config/routes.yaml
    
    admin:
        resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
        prefix: /admin
    
    phpcr_admin:
        resource: '@SonataDoctrinePhpcrAdminBundle/Resources/config/routing/tree.xml'
        prefix: /admin
    
    _sonata_admin:
        resource: .
        type: sonata_admin
        prefix: /admin
    
  • XML
    <!-- config/routes.xml -->
    <?xml version="1.0" encoding="UTF-8" ?>
    <routes xmlns="http://symfony.com/schema/routing"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://symfony.com/schema/routing
            http://symfony.com/schema/routing/routing-1.0.xsd">
    
        <import
            resource="@SonataAdminBundle/Resources/config/sonata_admin.xml"
            prefix="/admin"
        />
    
        <import
            resource="@SonataDoctrinePhpcrAdminBundle/Resources/config/routing/tree.xml"
            prefix="/admin"
        />
    
        <import
            resource="."
            type="sonata_admin"
            prefix="/admin"
        />
    
    </routes>
    
  • PHP
    // config/routes.php
    use Symfony\Component\Routing\RouteCollection;
    
    $collection = new RouteCollection();
    $routing = $loader->import(
        '@SonataAdminBundle/Resources/config/sonata_admin.xml'
    );
    $routing->setPrefix('/admin');
    $collection->addCollection($routing);
    
    $routing = $loader->import(
        '@SonataDoctrinePhpcrAdminBundle/Resources/config/routing/tree.xml'
    );
    $routing->setPrefix('/admin');
    $collection->addCollection($routing);
    
    $_sonataAdmin = $loader->import('.', 'sonata_admin');
    $_sonataAdmin->addPrefix('/admin');
    $collection->addCollection($_sonataAdmin);
    
    return $collection;
    

Found a typo? Something is wrong in this documentation? Just fork and edit it!