Closed tmihalicka closed 1 year ago
Please provide a failing mapping, or even better, a test case based on it. I'm wondering if you're getting the XSD file from doctrine-project.org, or from your vendor directory.
The XSD file hosted on doctrine-project.org does not have a version number, so I wouldn't use it.
Sure here is used mapping:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://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\Project\Domain\Model\Project\Project" table="project_project">
<id name="projectId" type="App\Project\Domain\Model\Project\ValueObject\ProjectId" column="id"/>
<one-to-many field="environments" target-entity="App\Project\Domain\Model\Environment\Environment" mapped-by="project"/>
<field name="name" type="App\Project\Domain\Model\Project\ValueObject\Name"/>
<field name="logo" type="App\Project\Domain\Model\Project\ValueObject\Logo" nullable="true"/>
<field name="code" type="App\Project\Domain\Model\Project\ValueObject\Code" unique="true"/>
</entity>
</doctrine-mapping>
i'm getting expcetion for example:
The value 'App\Project\Domain\Model\Project\ValueObject\Name' of attribute 'type' on element 'field' is not valid with respect to its type, 'NMTOKEN'.
Can you try this and let me know what happens:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://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">
+ xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping vendor/doctrine/orm/doctrine-mapping.xsd">
<entity name="App\Project\Domain\Model\Project\Project" table="project_project">
<id name="projectId" type="App\Project\Domain\Model\Project\ValueObject\ProjectId" column="id"/>
<one-to-many field="environments" target-entity="App\Project\Domain\Model\Environment\Environment" mapped-by="project"/>
<field name="name" type="App\Project\Domain\Model\Project\ValueObject\Name"/>
<field name="logo" type="App\Project\Domain\Model\Project\ValueObject\Logo" nullable="true"/>
<field name="code" type="App\Project\Domain\Model\Project\ValueObject\Code" unique="true"/>
</entity>
</doctrine-mapping>
Thank you but issue is still present after changing XSD schema location. Schema in vendor/doctrine/orm/doctrine-mapping.xsd
still have following type for attribute type in field:
<xs:attribute name="type" type="xs:NMTOKEN" default="string" />
this is also in attribute type in id as well.
I believe solution is change attribute type from xs:NMTOKEN
to orm:fqcn
or maybe for some new type which is compatible with FQCN or basic string.
Ah right. Can you please send a PR doing that, along with a test case that fails without your change?
Fix is provided in pull request above.
@greg0ire one question when we can expect release of version 2.14.3?
Bug Report
We'are using ValueObjects these value objects are mapped as doctrine types for example configuration from Symfony below:
For entities mapping we're using XML files. After upgrade to
doctrine/orm
to version2.14.2
. In this release XSD schema validation was enabled. And now we're getting following exception:Doctrine ORM XSD schema already contains
fqcn
typeWhy not use this type for type attribute for
field
andid
?Summary
Use FQCN in type attribute in XML mapping for
field
andid
Current behavior
Exception is thrown when type attribute contains FQCN
How to reproduce
Just insert any FQCN for type attribute for
field
andid
and exception in XML validation is thrown:Expected behavior
Ability to use FQCN in type attribute in XML mapping for
field
andid