Question

When I'm calling "/web/app_dev.php/en_US/admin/cmf/block/simpleblock/list" which should print the listing of my simpleblocks, I receive the following error:

Warning: Missing argument 1 for Doctrine\ODM\PHPCR\Query\QueryBuilder::from(), called in vendor/sonata-project/doctrine-phpcr-admin-bundle/Sonata/DoctrinePHPCRAdminBundle/Model/ModelManager.php on line 218 and defined in vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Query/QueryBuilder.php line 405

The missing argument should be the FQN of a document class.

I'm using CMF with SonataAdminBundle.

My config file:

 imports:
    - { resource: parameters.yml }
    - { resource: security.yml }

framework:
    #esi:             ~
    translator:       { fallback: de}
    secret:           %secret%
    router:
    resource: "%kernel.root_dir%/config/routing.yml"
    strict_requirements: ~
    form:            ~
    csrf_protection: ~
    validation:      { enable_annotations: true }
    templating:
    engines: ['twig']
    #assets_version: SomeVersionScheme
    default_locale:  "%locale%"
    trusted_proxies: ~
    session:         ~
    fragments:       ~

# CMF Routing
cmf_routing:
    chain:
    routers_by_id:
        # enable the DynamicRouter with high priority to allow overwriting configured routes with content
        cmf_routing.dynamic_router: 20
        # enable the symfony default router with a lower priority
        router.default: 100
    dynamic:
    enabled: true
    generic_controller: cmf_content.controller:indexAction
    controllers_by_class:
        Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute: cmf_routing.redirect_controller:redirectAction
        Symfony\Cmf\Bundle\ContentBundle\Document\StaticContent: cmf_content.controller::indexAction
    persistence:
        phpcr:
            enabled: true
            # use true/false to force using / not using sonata admin
            use_sonata_admin: true

            # used with Sonata Admin to manage content; defaults to %cmf_core.basepath%/content
            content_basepath: /
    locales:
        - de
        - en



cmf_core:
    persistence:
    phpcr:
        enabled: true
        basepath: /


cmf_block:
    persistence:
    phpcr:
        enabled: true
        manager_name: default
        use_sonata_admin: true
    use_imagine: false

cmf_content:
    persistence:
    phpcr:
        content_basepath: /content


lunetics_locale:
  allowed_locales:
    - de
    - en
  guessing_order:
    - query
    - session
    - cookie
    - browser
    - router


# Twig Configuration
twig:
    debug:            %kernel.debug%
    strict_variables: %kernel.debug%


# Assetic Configuration
assetic:
    debug:          %kernel.debug%
    use_controller: false
    bundles:        [ CmfCreateBundle ]
    #java: /usr/bin/java
    filters:
    cssrewrite: ~
    #closure:
    #    jar: %kernel.root_dir%/Resources/java/compiler.jar
    #yui_css:
    #    jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar

fos_rest:
    view:
    formats:
        json: true


# Doctrine Configuration
doctrine:
    dbal:
    driver:   %database_driver%
    host:     %database_host%
    port:     %database_port%
    dbname:   %database_name%
    user:     %database_user%
    password: %database_password%
    charset:  UTF8
    types:
        json: Sonata\Doctrine\Types\JsonType

    orm:
    auto_generate_proxy_classes: %kernel.debug%
    auto_mapping: true


# PHPCR (for CMF)
doctrine_phpcr:
    session:
    backend:
        type: doctrinedbal
        #connection: default
    workspace: default
    username: admin
    password: admin
    odm:
    document_managers:
        default:
            auto_mapping: true
            session: default
            mappings:
                CmfContentBundle: ~
                CmfMenuBundle: ~
                CmfRoutingBundle: ~
                CmfCreateBundle: ~
    auto_generate_proxy_classes: %kernel.debug%
    proxy_dir:            %kernel.cache_dir%/doctrine/PHPCRProxies
    proxy_namespace:      PHPCRProxies
    locales:
        de: [en]
        en: [de]


# Swiftmailer Configuration
swiftmailer:
    # Set to true if you'd like to stop mailing:
    disable_delivery: false
    transport: %mailer_transport%
    host:      %mailer_host%
    username:  %mailer_user%
    password:  %mailer_password%
    spool:     { type: memory }


# fos user bundle Configutation
fos_user:
    db_driver: orm
    firewall_name: main
    user_class: ASV\UserBundle\Entity\User
    group:
    group_class: ASV\UserBundle\Entity\Group
    registration:
    confirmation:
        enabled: true
    from_email:
    address:        noreply@...
    sender_name:    ...-Support


# Sonata Block Bundle
sonata_block:
    default_contexts: [cms]
    blocks:
    sonata.admin.block.admin_list:
        contexts:   [admin]

    # for cmf:
    sonata_admin_doctrine_phpcr.tree_block:
        settings:
            id: '/cms'
        contexts:   [admin]

    sonata.block.service.text: ~

    # Some specific block from the SonataMediaBundle
    #sonata.media.block.media:
    #sonata.media.block.gallery:
    #sonata.media.block.feature_media:



# Sonata Internationalization
sonata_intl:
    timezone:
    # default timezone used as fallback
    default: Europe/Berlin

    # locale specific overrides
    locales:
        de: Europe/Berlin
        en_UK: Europe/London


# Sonata User Bundle
sonata_user:
    security_acl: true
    manager_type: orm
    class:                  # Entity Classes
    user:               ASV\UserBundle\Entity\User
    group:              ASV\UserBundle\Entity\Group
    table:
    user_group: "fos_user_group"        

# Sonata Admin Bundle
# app/config/config.yml
sonata_admin:
    title:      Admin Backend
    title_logo: bundles/sonataadmin/logo_title.png
    extensions:
    cmf_routing.admin_extension.route_referrers:
        implements:
            - Symfony\Cmf\Component\Routing\RouteReferrersInterface
    templates:
    # default global templates
    layout:  SonataAdminBundle::standard_layout.html.twig
    ajax:    SonataAdminBundle::ajax_layout.html.twig

    dashboard: SonataAdminBundle:Core:dashboard.html.twig

    # default actions templates, should extend global templates
    list:    SonataAdminBundle:CRUD:list.html.twig
    show:    SonataAdminBundle:CRUD:show.html.twig
    edit:    SonataAdminBundle:CRUD:edit.html.twig

    list_block: SonataAdminBundle:Block:block_admin_list.html.twig

    user_block: ASVCoreBundle:Admin:admin_topnav.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 }

        # customized section example:
        #- { position: right, type: sonata.block.service.text, settings: { content: "<h2>Welcome to the Sonata Admin</h2> <p>This is a <code>sonata.block.service.text</code> from the Block Bundle, you can create and add new block in these area by configuring the <code>sonata_admin</code> section.</p> <br /> For instance, here a RSS feed parser (<code>sonata.block.service.rss</code>):"} }
        #- { position: right, type: sonata.block.service.rss, settings: { title: Sonata Project's Feeds, url: http://sonata-project.org/blog/archive.rss }}
    groups:
        content:
            label: Content
            items:
                - cmf_content.admin
                - cmf_block.simple_admin
                - cmf_block.container_admin
                - cmf_block.reference_admin
                - cmf_block.action_admin
        routing:
            label: URLs
            items:
                - cmf_routing.route_admin
                - cmf_routing.redirect_route_admin
        menu:
            label: Menu
            items:
                - cmf_menu.menu_admin
                - cmf_menu.node_admin


# for CMF:
sonata_doctrine_phpcr_admin:
    document_tree_defaults: [locale]
    document_tree:
    Doctrine\ODM\PHPCR\Document\Generic:
        valid_children:
            - all
    Symfony\Cmf\Bundle\ContentBundle\Doctrine\Phpcr\StaticContent:
        valid_children:
            - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SimpleBlock
            - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ContainerBlock
            - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ReferenceBlock
            - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ActionBlock
            - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SlideshowBlock
            - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\RssBlock
    Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ReferenceBlock:
        valid_children: []
    Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ActionBlock:
        valid_children: []
    Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SimpleBlock:
        valid_children: []
    Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SlideshowBlock:
        valid_children:
            - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ImagineBlock
    Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ImagineBlock:
        valid_children: []
    Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\RssBlock:
        valid_children: []
    Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ContainerBlock:
        valid_children:
            - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SimpleBlock
            - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ContainerBlock
            - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ReferenceBlock
            - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ActionBlock
            - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SlideshowBlock
            - Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\RssBlock
    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\Menu:
        valid_children:
            - Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode
    Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode:
        valid_children:
            - Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode

And this my composer.json:

{
    "name" : "symfony/framework-standard-edition",
    "description" : "The \"Symfony Standard Edition\" distribution",
    "type" : "project",
    "keywords" : [],
    "license" : [
        "MIT"
    ],
    "require" : {
        "doctrine/doctrine-fixtures-bundle" : "dev-master",
        "jackalope/jackalope-doctrine-dbal" : "dev-master",
        "friendsofsymfony/user-bundle" : "*",
        "symfony/swiftmailer-bundle" : "2.3.*",
        "sonata-project/cache-bundle" : "dev-master",
        "doctrine/orm" : ">=2.2.3,<2.4-dev",
        "sonata-project/user-bundle" : "dev-master",
        "friendsofsymfony/rest-bundle" : "1.0.*@dev",
        "symfony-cmf/create-bundle" : "1.0.*@dev",
        "lunetics/locale-bundle" : "dev-master",
        "twig/extensions" : "1.0.*",
        "php" : ">=5.3.3",
        "symfony-cmf/symfony-cmf" : "dev-master",
        "symfony/monolog-bundle" : "2.3.*",
        "symfony-cmf/media-bundle" : "1.0.*@dev",
        "sensio/distribution-bundle" : "2.3.*",
        "doctrine/phpcr-bundle" : "1.0.0-beta4",
        "symfony/symfony" : "2.3.*",
        "sonata-project/easy-extends-bundle" : "dev-master",
        "sonata-project/doctrine-orm-admin-bundle" : "2.*",
        "doctrine/phpcr-odm" : "1.0.0-beta5",
        "symfony/assetic-bundle" : "2.3.*",
        "incenteev/composer-parameter-handler" : "~2.0",
        "sonata-project/doctrine-phpcr-admin-bundle" : "dev-master",
        "sonata-project/intl-bundle" : "dev-master",
        "sensio/generator-bundle" : "2.3.*",
        "sensio/framework-extra-bundle" : "2.3.*",
        "doctrine/doctrine-bundle" : "1.2.*"
    },
    "autoload" : {
        "psr-0" : {
            "" : "src/"
        }
    },
    "minimum-stability" : "dev",
    "config" : {
        "bin-dir" : "bin"
    },
    "scripts" : {
        "post-update-cmd" : [
            "Symfony\\Cmf\\Bundle\\CreateBundle\\Composer\\ScriptHandler::downloadCreateAndCkeditor",
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-install-cmd" : [
            "Symfony\\Cmf\\Bundle\\CreateBundle\\Composer\\ScriptHandler::downloadCreateAndCkeditor",
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "extra" : {
        "branch-alias" : {
            "dev-master" : "2.3-dev"
        },
        "symfony-web-dir" : "web",
        "symfony-app-dir" : "app",
        "incenteev-parameters" : {
            "file" : "app/config/parameters.yml"
        }
    }
}

If there is any more information needed, I'm happy to provide it. I just didn't want to overfill this question.

Thank's for any hint and help in anticipation.

Was it helpful?

Solution

I figured it out.

The packages "doctrine/phpcr-odm" : "1.0.0-beta5" and "sonata-project/doctrine-phpcr-admin-bundle" : "dev-master" (1.0.0) didn't work together. I had to update "doctrine/phpcr-odm" : "1.0.0-beta5" to version 1.0.0.

This solved the issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top