Symfony 6.4 - Doctrine - Xml - 没有可用的匹配全局属性声明,但严格通配符要求

问题描述 投票:0回答:1

作曲家.json

        "doctrine/doctrine-bundle": "^2.11.1",
        "doctrine/doctrine-migrations-bundle": "^3.3.0",
        "doctrine/orm": "^2.17.2",

doctrine.yaml

        entity_managers:
            Default:
                connection: Default
                validate_xml_mapping: true

ByPass.orm.xml

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
    xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                        https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

    <entity
        name="App\Entity\ByPass"
        table="bypass"
        schema="access"
        repository-class="App\Repository\ByPassRepository">

            <id name="id" type="integer" column="id">
                <generator strategy="AUTO" />
            </id>

            <many-to-one field="role" target-entity="App\Entity\Role" inversed-by="bypasses">
                 <join-column name="role" referenced-column-name="id" on-delete="CASCADE" nullable="false" />
            </many-to-one>

            <field name="created_at" type="datetime" nullable="false" />
            <field name="created_by" type="string" length="32" nullable="false" />
            <field name="created_ip"  type="string" length="256" nullable="false" />            

    </entity>
</doctrine-mapping>

错误信息:

libxml error: Element '{http://doctrine-project.org/schemas/orm/doctrine-mapping}doctrine-mapping', attribute '{https://www.w3.org/2001/XMLSchema-instance}schemaLocation': No matching global attribute declaration available, but demanded by the strict wildcard.
in file:ByPass.orm.xml at line 5

有人可以解释为什么我会收到此错误吗?我使用的是 Doctrine 的官方参考:https://www.doctrine-project.org/projects/doctrine-orm/en/2.17/reference/xml-mapping.html

感谢您的帮助!

xml symfony doctrine-orm doctrine
1个回答
0
投票

有同样的问题。我刚刚删除了

validate_xml_mapping: true 

一切都很顺利

© www.soinside.com 2019 - 2024. All rights reserved.