Symfony,从v3.3升级到v3.4错误

时间:2018-04-05 06:55:07

标签: symfony

我将composer.json中的Symfony版本从3.3更改为3.4,然后运行update命令。

使用命令' composer update'升级到v3.4后,显示以下错误:

Ahmads-MacBook-Pro-2:Courses ahmadwa$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 2 updates, 0 removals
  - Updating symfony/symfony (v3.3.16 => v3.4.7): Loading from cache
  - Updating whiteoctober/breadcrumbs-bundle (1.4.0 => 1.4.1): Loading from cache
Writing lock file
Generating autoload files
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache

在Definition.php第263行:

  Service "security.authentication.provider.simple_form.secured_area": The in  
  dex "3" is not in the range [0, 2].                                          


Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception


  [RuntimeException]                                                               
  An error occurred when executing the "'cache:clear --no-warmup'" command:        

在Definition.php第263行:

    Service "security.authentication.provider.simple_form.secured_area": The in    
    dex "3" is not in the range [0, 2].                                            


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...

我的security.yml内容是:

security:
  encoders:
    AppBundle\Entity\User:
      algorithm: bcrypt
      cost: 12
  role_hierarchy:
    ROLE_ADMIN: [ROLE_USER]
  providers:
    user_db:
      entity: { class: "AppBundle:User" }
  firewalls:
    dev:
      pattern: "^/(_(profiler|wdt)|css|images|js)/"
      security: false
    secured_area:
      anonymous: ~
      pattern: "^/"
      simple_form:
        authenticator: courses_authenticator
        check_path: login_check
        login_path: login
      form_login:
        login_path: "/login"
        check_path: "/login_check"
        default_target_path: "/"
        username_parameter: "_username"
        password_parameter: "_password"
        use_referer: true
        success_handler: authentication_handler
        failure_handler: authentication_handler
      logout:
        path: "/logout"
        target: "/login"
        success_handler: authentication_handler
  access_denied_url: "/login"
  access_control:
    - { path: ^/admin, roles: ROLE_ADMIN }
    - { path: ^/university, roles: ROLE_UNIVERSITY }
    - { path: ^/developer, roles: [ROLE_DEVELOPER, ROLE_DESIGNER]}
    - { path: ^/designer, roles: ROLE_DESIGNER }
    - { path: ^/dean, roles: ROLE_DEAN }
    - { path: ^/head, roles: ROLE_HEAD }
    - { path: ^/changepassword, roles: [ROLE_ADMIN, ROLE_UNIVERSITY, ROLE_DEVELOPER, ROLE_DESIGNER, ROLE_DEAN, ROLE_HEAD] }
    - { path: ^/editprofile, roles: [ROLE_ADMIN, ROLE_UNIVERSITY, ROLE_DEVELOPER, ROLE_DESIGNER, ROLE_DEAN, ROLE_HEAD] }
    - { path: ^/welcomeMessageAgreement, roles: [ROLE_ADMIN, ROLE_UNIVERSITY] }

我的PHP版本是5.6.30

我搜索了网络和Symfony文档,但没有找到与此问题相关的内容。

1 个答案:

答案 0 :(得分:0)

我通过添加&#34; provider:user_db&#34;解决了这个问题。 to&#34; simple_form&#34;。 也许这有助于某人。

simple_form:
    provider: user_db
    authenticator: courses_authenticator
    check_path: login_check
    login_path: login