CMF 捆绑破坏学说?交响乐 2.8
CMF bundle breaking Doctrine? Symfony 2.8
这是我第一次将 Symfony2 的 CMF 与 SimpleCmsBundle 一起使用,我在正确设置它时遇到了很多困难。我似乎遇到的主要问题是当我清除缓存时 Doctrine 被打破了:
[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
You have requested a non-existent parameter "Could not determine the
Doctrine manager. Either Doctrine is not configured or a bundle i s
misconfigured.".
当我注释掉我的 CMF 捆绑包时,我没有收到此错误。这是我的配置:
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
knp_menu:
twig: true
cmf_core:
persistence:
phpcr:
enabled: true
sonata_block:
default_contexts: [sonata_page_bundle]
blocks:
sonata.admin.block.admin_list:
contexts: [admin]
#sonata.admin_doctrine_orm.block.audit:
# contexts: [admin]
sonata.block.service.text:
sonata.block.service.rss:
# Some specific block from the SonataMediaBundle
#sonata.media.block.media:
#sonata.media.block.gallery:
#sonata.media.block.feature_media:
# Some block with different templates
#acme.demo.block.demo:
# templates:
# - { name: 'Simple', template: 'AcmeDemoBundle:Block:demo_simple.html.twig' }
# - { name: 'Big', template: 'AcmeDemoBundle:Block:demo_big.html.twig' }
我的 AppKernel.php
文件:
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
new Symfony\Cmf\Bundle\CoreBundle\CmfCoreBundle(),
new Symfony\Cmf\Bundle\MenuBundle\CmfMenuBundle(),
new Symfony\Cmf\Bundle\ContentBundle\CmfContentBundle(),
// Dependencies of the CmfMenuBundle
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
// Dependencies of the CmfBlockBundle
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\BlockBundle\SonataBlockBundle()
);
据我所知,我已经添加了最低要求的配置,但我必须缺少一些东西,否则它肯定不会影响 Doctrine?
查看 Symfony CMF Standard Edition, you're most likely missing the inclusion of the DoctrinePHPCRBundle in your AppKernel:
$bundles = array(
// ...
new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
);
和相关的doctrine_phpcr configuration:
# app/config/config.yml
doctrine_phpcr:
odm: ~
这是我第一次将 Symfony2 的 CMF 与 SimpleCmsBundle 一起使用,我在正确设置它时遇到了很多困难。我似乎遇到的主要问题是当我清除缓存时 Doctrine 被打破了:
[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException] You have requested a non-existent parameter "Could not determine the Doctrine manager. Either Doctrine is not configured or a bundle i s misconfigured.".
当我注释掉我的 CMF 捆绑包时,我没有收到此错误。这是我的配置:
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
knp_menu:
twig: true
cmf_core:
persistence:
phpcr:
enabled: true
sonata_block:
default_contexts: [sonata_page_bundle]
blocks:
sonata.admin.block.admin_list:
contexts: [admin]
#sonata.admin_doctrine_orm.block.audit:
# contexts: [admin]
sonata.block.service.text:
sonata.block.service.rss:
# Some specific block from the SonataMediaBundle
#sonata.media.block.media:
#sonata.media.block.gallery:
#sonata.media.block.feature_media:
# Some block with different templates
#acme.demo.block.demo:
# templates:
# - { name: 'Simple', template: 'AcmeDemoBundle:Block:demo_simple.html.twig' }
# - { name: 'Big', template: 'AcmeDemoBundle:Block:demo_big.html.twig' }
我的 AppKernel.php
文件:
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
new Symfony\Cmf\Bundle\CoreBundle\CmfCoreBundle(),
new Symfony\Cmf\Bundle\MenuBundle\CmfMenuBundle(),
new Symfony\Cmf\Bundle\ContentBundle\CmfContentBundle(),
// Dependencies of the CmfMenuBundle
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
// Dependencies of the CmfBlockBundle
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\BlockBundle\SonataBlockBundle()
);
据我所知,我已经添加了最低要求的配置,但我必须缺少一些东西,否则它肯定不会影响 Doctrine?
查看 Symfony CMF Standard Edition, you're most likely missing the inclusion of the DoctrinePHPCRBundle in your AppKernel:
$bundles = array(
// ...
new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
);
和相关的doctrine_phpcr configuration:
# app/config/config.yml
doctrine_phpcr:
odm: ~