1

我正在尝试按照本教程安装 Symfony CMF Bundle https://symfony.com/doc/current/cmf/tutorial/introduction.html

当我尝试安装 Doctrine PHPCR Admin Bundle 时出现问题。遵循https://sonata-project.org/bundles/doctrine-phpcr-admin/master/doc/reference/installation.html中的步骤后

清除缓存时出现此错误

错误信息已编辑

[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
服务“sonata.admin.doctrine_phpcr.tree_controller”依赖于不存在的参数“cmf_resource.repositories.default_name”。

我的作曲家:

{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
    "psr-4": {
        "AppBundle\\": "src/AppBundle"
    },
    "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"autoload-dev": {
    "psr-4": { "Tests\\": "tests/" },
    "files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
},
"require": {
    "php": ">=7.1",
    "doctrine/data-fixtures": "^1.2",
    "doctrine/doctrine-bundle": "^1.6",
    "doctrine/orm": "^2.5",
    "doctrine/phpcr-bundle": "~1.2",
    "doctrine/phpcr-odm": "~1.2",
    "incenteev/composer-parameter-handler": "^2.0",
    "jackalope/jackalope-doctrine-dbal": "~1.1,>=1.1.2",
    "sensio/distribution-bundle": "^5.0.19",
    "sensio/framework-extra-bundle": "^3.0.2",
    "sonata-project/doctrine-phpcr-admin-bundle": "^2.0",
    "symfony-cmf/menu-bundle": "^2.1",
    "symfony-cmf/routing-auto-bundle": "^2.0",
    "symfony-cmf/routing-bundle": "^2.0",
    "symfony-cmf/tree-browser-bundle": "^2.0",
    "symfony/monolog-bundle": "^3.1.0",
    "symfony/polyfill-apcu": "^1.0",
    "symfony/swiftmailer-bundle": "^2.3.10",
    "symfony/symfony": "3.3.*",
    "twig/twig": "^1.0||^2.0"
},
"require-dev": {
    "sensio/generator-bundle": "^3.0",
    "symfony/phpunit-bridge": "^3.0"
},
"scripts": {
    "symfony-scripts": [
        "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",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
    ],
    "post-install-cmd": [
        "@symfony-scripts"
    ],
    "post-update-cmd": [
        "@symfony-scripts"
    ]
},
"config": {
    "platform": {
        "php": "7.1"
    },
    "sort-packages": true
},
"extra": {
    "symfony-app-dir": "app",
    "symfony-bin-dir": "bin",
    "symfony-var-dir": "var",
    "symfony-web-dir": "web",
    "symfony-tests-dir": "tests",
    "symfony-assets-install": "relative",
    "incenteev-parameters": {
        "file": "app/config/parameters.yml"
    },
    "branch-alias": {
        "dev-master": "3.3-dev"
    }
    }
  }

我的 AppKrenel:

    public function registerBundles()
{
    $bundles = [
        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 Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
        new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
        new Symfony\Cmf\Bundle\RoutingAutoBundle\CmfRoutingAutoBundle(),
        new FOS\JsRoutingBundle\FOSJsRoutingBundle(),

        // SonataAdminBundle related
        new Sonata\CoreBundle\SonataCoreBundle(),
        new Sonata\BlockBundle\SonataBlockBundle(),
        new Knp\Bundle\MenuBundle\KnpMenuBundle(),
        new Sonata\AdminBundle\SonataAdminBundle(),

        // SonataDoctrinePhpcrAdminBundle related
        new Symfony\Cmf\Bundle\TreeBrowserBundle\CmfTreeBrowserBundle(),
        new Sonata\DoctrinePHPCRAdminBundle\SonataDoctrinePHPCRAdminBundle(),

        // CmfSonataPhpcrAdminIntegrationBundle
        //new Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\CmfSonataPhpcrAdminIntegrationBundle(),

    ];

    if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
        $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
        $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
        $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();

        if ('dev' === $this->getEnvironment()) {
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
            $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
        }
    }

    return $bundles;
}

我的配置:

doctrine_phpcr:
  # configure the PHPCR session
  session:
    backend: "%phpcr_backend%"
    workspace: "%phpcr_workspace%"
    username: "%phpcr_user%"
    password: "%phpcr_pass%"
  # enable the ODM layer
  odm:
    auto_mapping: true
    auto_generate_proxy_classes: "%kernel.debug%"
 cmf_routing:
   chain:
     routers_by_id:
        cmf_routing.dynamic_router: 200
        router.default: 100
   dynamic:
     enabled: true
     persistence:
        phpcr: true
 cmf_routing_auto:
   persistence:
      phpcr:
        enabled: true
sonata_admin:
    dashboard:
        blocks:
          - { position: left, type:             sonata_admin_doctrine_phpcr.tree_block }
          - { position: right, type: sonata.admin.block.admin_list }
sonata_block:
   default_contexts: [cms]
   blocks:
sonata_doctrine_phpcr_admin:
    templates:
        form:
            # Default:
            - SonataDoctrinePHPCRAdminBundle:Form:form_admin_fields.html.twig
       filter:
           # Default:
            - SonataDoctrinePHPCRAdminBundle:Form:filter_admin_fields.html.twig
       types:
          list:
              # Prototype
              name:             l1
              #    []
          show:
              # Prototype
              name:             s1
              #[]
      pager_results:        SonataDoctrinePHPCRAdminBundle:Pager:simple_pager_results.html.twig
  document_tree:
    routing_defaults: [locale]
    repository_name: default
    sortable_by: position
4

0 回答 0