无法在SonataAdminBundle :: standard_layout.html.twig中找到模板“SonataCoreBundle:FlashMessage:render.html.twig”

时间:2013-12-26 11:38:16

标签: symfony symfony-2.3

在Sonata admin中请求URL时收到此错误消息:

  

无法找到模板   “SonataCoreBundle:FlashMessage:render.html.twig”in   第188行的SonataAdminBundle :: standard_layout.html.twig。

我重新安装了所有供应商,但错误是一样的..

这是我的composer.json和我的config.yml

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.3.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "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",
        "ziiweb/frontendbundle": "@dev",
        "friendsofsymfony/user-bundle": "~2.0@dev",
        "sonata-project/admin-bundle": "dev-master",
        "sonata-project/doctrine-orm-admin-bundle": "dev-master",
        "sonata-project/media-bundle": "dev-master"
    },
    "scripts": {
        "post-install-cmd": [
            "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-update-cmd": [
            "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"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "stable",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.3-dev"
        }
    }
}


imports:
    - { resource: parameters.yml }
    - { resource: security.yml }
    - { resource: @ProjectUserBundle/Resources/config/admin.yml }
    - { resource: @ProjectAdminBundle/Resources/config/admin.yml }

framework:
    #esi:             ~
    #translator:      { fallback: %locale% }
    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:       ~
    http_method_override: true

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

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

parameters:
    assetic.filter.compass.images_dir: %kernel.root_dir%/../web/bundles/projectfrontend/images
    assetic.filter.compass.http_path: /bundles/projectfrontend
    assetic.filter.compass.generated_images_path: %kernel.root_dir%/../web/bundles/projectfrontend/images

# 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

        # if using pdo_sqlite as your database driver, add the path in parameters.yml
        # e.g. database_path: %kernel.root_dir%/data/data.db3
        # path:     %database_path%

    orm:
        auto_generate_proxy_classes: %kernel.debug%
        auto_mapping: true
        #entity_managers:
            #default:
            #mappings:
                #SonataMediaBundle: ~

# Swiftmailer Configuration
swiftmailer:
    transport: %mailer_transport%
    host:      %mailer_host%
    username:  %mailer_user%
    password:  %mailer_password%
    spool:     { type: memory }


fos_user:
    db_driver: orm
    firewall_name: main
    user_class: Project\Bundle\UserBundle\Entity\User

knp_menu:
    twig:  # use "twig: false" to disable the Twig extension and the TwigRenderer
        template: knp_menu.html.twig
    templating: false # if true, enables the helper for PHP templates
    default_renderer: twig # The renderer to use, list is also available by default

sonata_block:
    default_contexts: [cms]
    blocks:
        sonata.admin.block.admin_list:
            contexts:   [admin]

        sonata.block.service.text:
        sonata.block.service.rss:


sonata_media:
    # if you don't use default namespace configuration
    #class:
    #    media: MyVendor\MediaBundle\Entity\Media
    #    gallery: MyVendor\MediaBundle\Entity\Gallery
    #    gallery_has_media: MyVendor\MediaBundle\Entity\GalleryHasMedia
    default_context: default
    db_driver: doctrine_orm # or doctrine_mongodb, doctrine_phpcr
    contexts:
        default:  # the default context is mandatory
            providers:
                - sonata.media.provider.dailymotion
                - sonata.media.provider.youtube
                - sonata.media.provider.image
                - sonata.media.provider.file

            formats:
                small: { width: 100 , quality: 70}
                big:   { width: 500 , quality: 70}

    cdn:
        server:
            path: /uploads/media # http://media.sonata-project.org/

    filesystem:
        local:
            directory:  %kernel.root_dir%/../web/uploads/media
    providers:
        image:
            resizer: sonata.media.resizer.custom # THIS IS OUR NEW RESIZER SERVICE
            #create:     false

#doctrine_phpcr:
    #odm:
        #auto_mapping: true
        #mappings:
            #SonataMediaBundle:
                #prefix: Sonata\MediaBundle\PHPCR

2 个答案:

答案 0 :(得分:7)

您必须将sonata-core包添加到您的composer.json:

"sonata-project/core-bundle": "dev-master"

并重新安装供应商。应该有所帮助。

答案 1 :(得分:2)

如果你看一下奏鸣曲admin bundle composer.json file,你会发现 sonata-project / core-bundle 需要 @dev ,但如果你的项目 &#34;最低稳定性&#34; 高于&#34; dev&#34; (通常&#34;稳定&#34; )然后< strong> sonata-project / core-bundle 将安装稳定版本(现在 2.2.2 ),此资源为absent

实际上,如果您使用开发套件,请准备好将&#34;最小稳定性&#34; 降低到&#34; dev&#34; 或手动跟踪&#34; dev&#34; 依赖项,因为默认情况下它们未在层次结构中安装。 您可以在Igor's blog post

了解有关稳定性标志的更多信息

而且,是的,我建议您坚持使用更明确的版本,然后再进行最新的开发,例如: &#34; ~2.2@dev"