Skip to content

Use FQCN in type atribute in XML mapping for field and id #10627

@tmihalicka

Description

@tmihalicka

Bug Report

We'are using ValueObjects these value objects are mapped as doctrine types for example configuration from Symfony below:

doctrine:
  dbal:
    default_connection: default
    types:
       App\Project\Domain\Model\Project\ValueObject\ProjectId: App\Project\Infrastructure\Persistence\Doctrine\CustomTypes\Project\RamseyProjectIdType
     ... 

For entities mapping we're using XML files. After upgrade to doctrine/orm to version 2.14.2. In this release XSD schema validation was enabled. And now we're getting following exception:

libxml error: Element '{[http://doctrine-project.org/schemas/orm/doctrine-mapping}id](http://doctrine-project.org/schemas/orm/doctrine-mapping%7Did)', attribute 'type': App\Project\Domain\Model\Project\ValueObject\ProjectId' is not a valid value of the atomic type 'xs:NMTOKEN'.

Doctrine ORM XSD schema already contains fqcn type

  <xs:simpleType name="fqcn" id="fqcn">
    <xs:restriction base="xs:token">
      <xs:pattern value="[a-zA-Z_u01-uff][a-zA-Z0-9_u01-uff]+" id="fqcn.pattern">
      </xs:pattern>
    </xs:restriction>
  </xs:simpleType>

Why not use this type for type attribute for field and id?

Q A
BC Break no
Version 2.14.3

Summary

Use FQCN in type attribute in XML mapping for field and id

Current behavior

Exception is thrown when type attribute contains FQCN

How to reproduce

Just insert any FQCN for type attribute for field and id and exception in XML validation is thrown:

libxml error: Element '{[http://doctrine-project.org/schemas/orm/doctrine-mapping}id](http://doctrine-project.org/schemas/orm/doctrine-mapping%7Did)', attribute 'type': App\Project\Domain\Model\Project\ValueObject\ProjectId' is not a valid value of the atomic type 'xs:NMTOKEN'.

Expected behavior

Ability to use FQCN in type attribute in XML mapping for field and id

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions