2

When I try to access /cms/simple/contact (or any other path from phpcr_nodes table) I get the following error:

Notice: Undefined offset: 0 in /home/xx/xx/xx/public_html/vendor/symfony/symfony/src/Symfony/Component/Routing/RouteCompiler.php line 169 

First off, I'm not using Symfony CMF as a standalone, but only as a small part of a much larger project. We need WYSIWYG page editing by end users for some of the pages.

Some of the configs:

composer.json

"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.3.*",
    "doctrine/orm": "2.3.*",
    "doctrine/doctrine-bundle": "1.2.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.3.*",
    "symfony/swiftmailer-bundle": "2.3.*",
    "symfony/monolog-bundle": "2.3.*",
    "sensio/distribution-bundle": "2.3.*",
    "sensio/framework-extra-bundle": "2.3.*",
    "sensio/generator-bundle": "2.3.*",
    "incenteev/composer-parameter-handler": "~2.0",
    "ircmaxell/password-compat": "1.0.*",
    "sonata-project/seo-bundle": "1.1.*",
    "leaseweb/memcache-bundle": "*",
    "facebook/php-sdk" : "3.2.*",
    "phpunit/dbunit": ">=1.2",
    "symfony-cmf/symfony-cmf": "1.0.*",
    "symfony-cmf/simple-cms-bundle": "1.0.*",
    "symfony-cmf/create-bundle": "1.0.*",
    "jackalope/jackalope-doctrine-dbal": "1.0.*",
    "doctrine/data-fixtures": "1.0.*",
    "lunetics/locale-bundle": "2.2.*",
    "liip/doctrine-cache-bundle": "1.0.*",
    "liip/imagine-bundle": "~0.12",
    "wjzijderveld/check-bundles": "1.0.*@dev",
    "doctrine/phpcr-bundle": "1.0.*",
    "doctrine/phpcr-odm": "1.0.*",
    "sonata-project/doctrine-phpcr-admin-bundle": "1.0.*"
},

App Kernel:

        new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
        new Liip\DoctrineCacheBundle\LiipDoctrineCacheBundle(),
        new Knp\Bundle\MenuBundle\KnpMenuBundle(),
        new Lunetics\LocaleBundle\LuneticsLocaleBundle(),
        new FOS\RestBundle\FOSRestBundle(),
        new JMS\SerializerBundle\JMSSerializerBundle($this),
        new Liip\ImagineBundle\LiipImagineBundle(),

        // enable cmf bundles
        new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
        new Symfony\Cmf\Bundle\CoreBundle\CmfCoreBundle(),
        new Symfony\Cmf\Bundle\MenuBundle\CmfMenuBundle(),
        new Symfony\Cmf\Bundle\ContentBundle\CmfContentBundle(),
        new Symfony\Cmf\Bundle\SimpleCmsBundle\CmfSimpleCmsBundle(),
        new Symfony\Cmf\Bundle\MediaBundle\CmfMediaBundle(),
        new Symfony\Cmf\Bundle\CreateBundle\CmfCreateBundle(),

        // support for the admin
        new Symfony\Cmf\Bundle\TreeBrowserBundle\CmfTreeBrowserBundle(),
        new Sonata\jQueryBundle\SonatajQueryBundle(),
        new Sonata\BlockBundle\SonataBlockBundle(),
        new Sonata\AdminBundle\SonataAdminBundle(),
        new Sonata\DoctrinePHPCRAdminBundle\SonataDoctrinePHPCRAdminBundle(),
        new FOS\JsRoutingBundle\FOSJsRoutingBundle(),

config.yml

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:
                - rs

liip_doctrine_cache:
    namespaces:
        meta:
            type: file_system
        nodes:
            type: file_system

cmf_core:
    persistence:
        phpcr:
            enabled: true
            basepath: /cms
    publish_workflow:
        enabled: false
    multilang:
        locales: %locales%

cmf_create:
    editor_base_path: /bundles/cmfcreate/vendor/ckeditor/

cmf_simple_cms:
    routing:
        templates_by_class:
            Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page: CmfSimpleCmsBundle:Page:index.html.twig
        controllers_by_class:
            Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute: cmf_routing.redirect_controller:redirectAction

knp_menu:
    twig: true

lunetics_locale:
    strict_mode: true
    guessing_order:
        - cookie
        - router
        - browser
    allowed_locales: %locales%

sonata_block:
    default_contexts: [cms]
    blocks:
        sonata.admin.block.admin_list:
            contexts:   [admin]
        sonata_admin_doctrine_phpcr.tree_block:
            settings:
                id: '/cms'
            contexts:   [admin]

cmf_routing:
    chain:
        routers_by_id:
            cmf_routing.dynamic_router: 200
            router.default: 100
    dynamic:
        enabled: true

sonata_admin:
    templates:
        # default global templates
        ajax:    SonataAdminBundle::ajax_layout.html.twig
    dashboard:
        blocks:
            # display a dashboard block
            - { position: right, type: sonata.admin.block.admin_list }
            - { position: left, type: sonata_admin_doctrine_phpcr.tree_block }

sonata_doctrine_phpcr_admin:
    document_tree:
        Doctrine\ODM\PHPCR\Document\Generic:
            valid_children:
                - all
        # if you are using the SimpleCmsBundle, enable the Page as well
        Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page:
             valid_children:
                 - all
        Symfony\Cmf\Bundle\ContentBundle\Doctrine\Phpcr\StaticContent:
            valid_children:
                - all
        Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route:
            valid_children:
                - Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route
                - Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute
        Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute:
            valid_children: []
        Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode:
            valid_children:
                - Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode

routing.yml

cmf_create_rest:
    resource: "@CmfCreateBundle/Resources/config/routing/rest.xml"

cmf_create_image:
    resource: "@CmfCreateBundle/Resources/config/routing/image.xml"

admin:
    resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
    prefix: /admin

sonata_admin:
    resource: .
    type: sonata_admin
    prefix: /admin

fos_js_routing:
    resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"

cmf_tree:
    resource: .
    type: 'cmf_tree'

I also did

$ php composer.phar update
$ php app/console doctrine:phpcr:init:dbal
$ php app/console doctrine:phpcr:repository:init
$ php app/console doctrine:phpcr:fixtures:load --append

(Append because I'm certainly not going to delete the existing data)

I checked the database and the phpcr_nodes contains appropriate data. I also did var_dumps couple steps before the RouteCompiler gets called and the data from the DB is indeed being loaded properly.

What am I missing?

Shinhan
  • 2,820
  • 2
  • 18
  • 21
  • this looks like the IdPrefixListener did not get activated. as i don't get notified about responses on stackoverflow, best open an issue on cmf-sandbox linking to this post, so that we can discuss there. – dbu Dec 15 '13 at 11:23
  • a few questions: do you only want to use the simplecms? or multilang routes with the dynamic router of routingbundle? could you dump the $tokens right before the error and show that? if you do not create new pages but only have a couple of editable ones, a very simple solution could be to use CreateBundle with content stored in the orm. a lot less flexibility, but if you don't need the flexibility, its also a lot less complexity. – dbu Dec 15 '13 at 11:26
  • If I needed *only* simplecms I would have much easier time since I could use the create-project symfony-cmf/standard-edition. But for our website, the CMS just a very small part of a very large project. Our admins will need to create new pages (some of which will be blog posts with comments). Multilang is completely superflous but I don't know how to disable multilang support. I'll check the tokens and I made the issue in the cmf-sandbox github. – Shinhan Dec 16 '13 at 08:38
  • ah sorry, seems i was not clear with my question. i understood that you add the cmf to an existing project. the "only" was about whether you want to use the Page document of simplecms or the StaticContent of ContentBundle. the Page is a lot simpler to use and fully enough if you do not have multilang. – dbu Dec 16 '13 at 08:55

0 Answers0