Sylius 自定义模型,错误 class 在命名空间中找不到

Sylius Customizing Models with error class not found in namespaces

我按照 Sylius 网站上的指南自定义模型: http://docs.sylius.com/en/1.0/customization/model.html

当我运行:

php bin/console doctrine:schema:update --force

或 php bin/console doctrine:migrations:diff

错误:在链配置的命名空间中找不到 class 'AppBundle\Entity\Country'

文件添加于: \src\AppBundle\Entity\Country.php \src\AppBundle\Resources\config\doctrine\Country.orm.yml

已添加:

sylius_addressing:
    resources:
        country:
            classes:
                model: AppBundle\Entity\Country

在: \app\config\config.yml

和config.yml上的学说相关设置如下:

doctrine:
    dbal:
    driver: "%database_driver%"
    host: "%database_host%"
    port: "%database_port%"
    dbname: "%database_name%"
    user: "%database_user%"
    password: "%database_password%"
    server_version: "5.5"
    charset: UTF8

doctrine_migrations:
    dir_name: "%kernel.root_dir%/migrations"
    namespace: Sylius\Migrations
    table_name: sylius_migrations
    name: Sylius Migrations

Country.php

<?php
namespace AppBundle\Entity;
use Sylius\Component\Addressing\Model\Country as BaseCountry;
class Country extends BaseCountry
{
  private $flag;

  public function getFlag(): ?bool
  {
    return $this->flag;
  }

  public function setFlag(bool $flag): void
  {
    $this->flag = $flag;
  }
}

(Sylius 1.0 安装在 Windows 7 上) 尝试了清除缓存和许多其他方法,但没有任何线索。

您在 config.yml 中有一个缩进错误,它应该是: sylius_addressing: resources: country: classes: model: AppBundle\Entity\Country

(你在国家之前没有制表符)

Thanks, but just check again, the tab already included.

YAML 禁止标签。请改用 2 或 4 个空格。参见 here

我已经安装了最新版本 (1.1.6) 并且可以使用!

所以,应该是 1.0.0 版本的错误...