简体   繁体   English

我无法从奏鸣曲安装用户包

[英]I can't install the user bundle from sonata

I'm triying to install the user bundle from symfony sonata with:我正在尝试从 symfony 奏鸣曲安装用户包:

composer require sonata-project/user-bundle

following the documentation in:遵循以下文档:

https://sonata-project.org/bundles/user/4-x/doc/reference/installation.html https://sonata-project.org/bundles/user/4-x/doc/reference/installation.html

but it always bring me the error但它总是给我带来错误

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!
!!  In ArrayNode.php line 224:
!!
!!    The child node "db_driver" at path "fos_user" must be configured.
!!
!!
!!

here's my composer.json file这是我的 composer.json 文件

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": ">=7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "composer/package-versions-deprecated": "1.11.99.1",
        "doctrine/annotations": "^1.0",
        "doctrine/doctrine-bundle": "^2.2",
        "doctrine/doctrine-migrations-bundle": "^3.0",
        "doctrine/orm": "^2.8",
        "phpdocumentor/reflection-docblock": "^5.2",
        "sensio/framework-extra-bundle": "^5.1",
        "sonata-project/admin-bundle": "^3.90",
        "sonata-project/doctrine-orm-admin-bundle": "^3.30",
        "symfony/asset": "4.4.*",
        "symfony/console": "4.4.*",
        "symfony/dotenv": "4.4.*",
        "symfony/expression-language": "4.4.*",
        "symfony/flex": "^1.3.1",
        "symfony/form": "4.4.*",
        "symfony/framework-bundle": "4.4.*",
        "symfony/http-client": "4.4.*",
        "symfony/intl": "4.4.*",
        "symfony/mailer": "4.4.*",
        "symfony/monolog-bundle": "^3.1",
        "symfony/process": "4.4.*",
        "symfony/property-access": "4.4.*",
        "symfony/property-info": "4.4.*",
        "symfony/proxy-manager-bridge": "4.4.*",
        "symfony/security-bundle": "4.4.*",
        "symfony/serializer": "4.4.*",
        "symfony/translation": "4.4.*",
        "symfony/twig-bundle": "^4.4",
        "symfony/validator": "4.4.*",
        "symfony/web-link": "4.4.*",
        "symfony/yaml": "4.4.*",
        "twig/extra-bundle": "^2.9",
        "twig/twig": "^2.9"
    },
    "require-dev": {
        "symfony/browser-kit": "^4.4",
        "symfony/css-selector": "^4.4",
        "symfony/debug-bundle": "^4.4",
        "symfony/maker-bundle": "^1.0",
        "symfony/phpunit-bridge": "^5.2",
        "symfony/stopwatch": "^4.4",
        "symfony/var-dumper": "^4.4",
        "symfony/web-profiler-bundle": "^4.4"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.4.*"
        }
    }
}

befor the this error there was an other error that told me to change the twig version to an older one so first i changed twig/extra-bundle": "^2.12|^3.0" twig/twig": "^2.12|^3.0"在出现此错误之前,还有另一个错误告诉我将 twig 版本更改为旧版本,所以首先我更改了 twig/extra-bundle": "^2.12|^3.0" twig/twig": "^2.12|^3.0 "

to twig/extra-bundle": "^2.9","twig/twig": "^2.9"到树枝/额外捆绑”:“^2.9”,“树枝/树枝”:“^2.9”

and then this happend, what should i do?然后这发生了,我该怎么办?

Just you need to add this configuration to your config file, go to this path app/config/config.yml and then add this lines to the end of your config.yml file只需将此配置添加到配置文件 go 到此路径app/config/config.yml ,然后将此行添加到config.yml文件的末尾

# app/config/config.yml
fos_user:
     db_driver: orm # other valid values are 'mongodb' and 'couchdb'
     firewall_name: main
     user_class: UserBundle\Entity\User
     from_email:
         address: "%mailer_user%"
         sender_name: "%mailer_user%"

Try to create fos_user.yaml in packages and add this code尝试在包中创建 fos_user.yaml 并添加此代码

fos_user.yaml fos_user.yaml

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: Entity\User
    from_email:
        address: "%mailer_user%"
        sender_name: "%mailer_user%"

and in your framework.yaml,add this code framework.yaml并在您的框架中。yaml,添加此代码框架。yaml

framework:
    templating:
        engines: ['twig', 'php']

So here's what i did to make it finally work first i created a fos_user.yaml file in config/packages/fos_user.yaml like this所以这就是我为使它最终工作所做的事情,我首先在config/packages/fos_user.yaml中创建了一个fos_user.yaml文件,如下所示

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: App\Entity\SonataUserUser
    group:
        group_class: App\Entity\SonataUserGroup
        group_manager: sonata.user.orm.group_manager
    service:
        user_manager: sonata.user.orm.user_manager
    from_email:
        address: "%mailer_user%"
        sender_name: "%mailer_user%"

then i created the parameter %mailer_user% in config/service.yaml like this然后我像这样在config/service.yaml中创建了参数%mailer_user%

parameters:
    mailer_user: -

finally i added this to framework.yaml最后我把它添加到了framework.yaml

framework:
    templating:
            engines: ['twig', 'php']

and it installed successfully but i did have to add the remaining files and configurations and other code manually that are present in the doc of sonata.它安装成功,但我确实必须手动添加奏鸣曲文档中存在的剩余文件和配置以及其他代码。

thank you for your help谢谢您的帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM