0

我在安装 Sonata 项目演示时遇到问题。按照这个...

我遇到以下问题:

Unable to register extension "sandbox" as extensions have already been initialized.

  in /var/www/nfq/sandbox/sonata-sandbox/vendor/twig/twig/lib/Twig/Environment.php line 627
at Twig_Environment->addExtension(object(Twig_Extension_Sandbox))
  in /var/www/nfq/sandbox/sonata-sandbox/app/cache/dev/appDevDebugProjectContainer.php line 7111
at appDevDebugProjectContainer->getSonata_Formatter_Twig_Env_MarkdownService()
  in /var/www/nfq/sandbox/sonata-sandbox/app/bootstrap.php.cache line 211
4

2 回答 2

1

问题出在 Sonata Formatter 中,我也有同样的问题,所以我只是评论了从 config.yml 导入其配置的行

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

# Sonata Bundles
- { resource: sonata/sonata_admin.yml }
- { resource: sonata/sonata_block.yml }
- { resource: sonata/sonata_media.yml }
#- { resource: sonata/sonata_formatter.yml }
- { resource: sonata/sonata_news.yml }
- { resource: sonata/sonata_cache.yml }
- { resource: sonata/sonata_seo.yml }
- { resource: sonata/sonata_notification.yml }
- { resource: sonata/sonata_user.yml }

编辑:

把它放在composer.json所需的库中:

"twig/twig": "1.11.1"
于 2012-12-03T12:04:48.570 回答
0

或者您可以按照格式化程序捆绑配置设置

sonata_formatter:
    formatters:
        markdown:
            service: sonata.formatter.text.markdown
            extensions: []

        text:
            service: sonata.formatter.text.text
            extensions: []

        twig:
            service: sonata.formatter.text.twigengine
            extensions: [] # Twig formatter cannot have extensions

更多在奏鸣曲网站 http://sonata-project.org/bundles/formatter/master/doc/reference/installation.html

于 2013-01-13T22:41:24.720 回答