SonataAdminBundle: block type not found

Sonata packages

sonata-project/admin-bundle              3.4.0                    The missing Symfony Admin Generator
sonata-project/block-bundle              3.1.1                    Symfony SonataBlockBundle
sonata-project/cache                     1.0.7                    Cache library
sonata-project/core-bundle               3.0.3                    Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.2                      Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.0.2                    Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.0.5                    Symfony Sonata / Integrate Doctrine ORM into the...
sonata-project/easy-extends-bundle       2.1.10                   Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.5.0                    Lightweight Exporter library
sonata-project/google-authenticator      1.0.2                    Library to integrate Google Authenticator into a...
sonata-project/user-bundle               dev-rc_sf3tweaks bf121be Symfony SonataUserBundle

Symfony packages

symfony/monolog-bundle     2.11.1  Symfony MonologBundle
symfony/phpunit-bridge     v3.1.2  Symfony PHPUnit Bridge
symfony/polyfill-apcu      v1.2.0  Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-intl-icu  v1.2.0  Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring  v1.2.0  Symfony polyfill for the Mbstring extension
symfony/polyfill-php56     v1.2.0  Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70     v1.2.0  Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util      v1.2.0  Symfony utilities for portability of PHP codes
symfony/security-acl       v3.0.0  Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.3.11 Symfony SwiftmailerBundle
symfony/symfony            v3.1.2  The Symfony PHP framework

PHP version

PHP 5.6.1 (cli) (built: Oct  1 2014 13:25:57)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies

Subject

I am unable to position blocks to my admin dashboard. Every service, custom or sonata blocks return the error below

An exception has been thrown during the rendering of a template ("The block type "app.admin.block.topnumbers" does not exist") in SonataAdminBundle:Core:dashboard.html.twig at line 60.

Here’s my config.yml

sonata_block:
    default_contexts: [cms]
    blocks:
        sonata.user.block.menu:    # used to display the menu in profile pages
        sonata.user.block.account: # used to display menu option (login option)
        app.admin.block.topnumbers:
            contexts:   [admin]
        sonata.admin.block.admin_list:
            contexts:   [admin]

sonata_admin:
    dashboard:
        blocks:
            -
                position: top
                type:   app.admin.block.topnumbers

Here’s the service definition in service.yml

app.admin.block.topnumbers:
        class: AppBundle\Block\NumbersBlockService
        arguments:
            -   'app.admin.block.topnumbers'
            -   "@templating"
            -   "@doctrine.orm.entity_manager"
            -   "@security.token_storage"
        tags:
            - { name: sonata.block }

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 24 (12 by maintainers)

Most upvoted comments

I’ll make sure get my beer if I ever come to Nairobi 😃

Anyway, I think we can close this now, right?

Haha, I live in Nairobi so unless you’re coming for holiday to Africa any time soon! I will keep it chilled in the mean time.

The error message has changed, the bottom block definition had the admin_list specified I guess that’s why it was the only registered block

Maybe you have two separate sonata_block configuration blocks? Can you grep -rn sonata_block app ?

what do you know, you are actually right! I am so embarrassed at taking all your time and effort. If I could only buy you a beer!!!