ConvertMappingCommand does not work from attributes to xml #6960

Closed
opened 2026-01-22 15:42:10 +01:00 by admin · 0 comments
Owner

Originally created by @bartholdbos on GitHub (Apr 13, 2022).

Bug Report

Q A
BC Break no
Version 2.11.2

Summary

Exporting attribute mappings to xml mappings does not work

Current behavior

When exporting attribute based mappings to xml mappings with the ConvertMappingCommand the following error occurs:

In AttributeReader.php line 27:
                                                                                                                                                                                                                                                                       
  Doctrine\ORM\Mapping\Driver\AttributeReader::getClassAnnotations(): Argument #1 ($class) must be of type ReflectionClass, null given, called in /home/bbos/projects/attributebug/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php on line 75  
                                                                                                                                                                                                                                                                       

The problem is that the AttributeDriver does not have a ReflectionClass available. This seems to be caused by the ConvertMappingCommand which instantiates a DisconnectedClassMetadataFactory. This metadataFactory only has a StaticReflectionService which does not create ReflectionClasses.

How to reproduce

https://github.com/bartholdbos/attribute_bug

run bin/console doctrine:mapping:convert xml mappings

Expected behavior

XML mappings files being generated into the given directory

Originally created by @bartholdbos on GitHub (Apr 13, 2022). ### Bug Report | Q | A |------------ | ------ | BC Break | no | Version | 2.11.2 #### Summary Exporting attribute mappings to xml mappings does not work #### Current behavior When exporting attribute based mappings to xml mappings with the ConvertMappingCommand the following error occurs: ``` In AttributeReader.php line 27: Doctrine\ORM\Mapping\Driver\AttributeReader::getClassAnnotations(): Argument #1 ($class) must be of type ReflectionClass, null given, called in /home/bbos/projects/attributebug/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php on line 75 ``` The problem is that the AttributeDriver does not have a ReflectionClass available. This seems to be caused by the ConvertMappingCommand which instantiates a DisconnectedClassMetadataFactory. This metadataFactory only has a StaticReflectionService which does not create ReflectionClasses. #### How to reproduce https://github.com/bartholdbos/attribute_bug run `bin/console doctrine:mapping:convert xml mappings` #### Expected behavior XML mappings files being generated into the given directory
admin added the Bug label 2026-01-22 15:42:10 +01:00
admin closed this issue 2026-01-22 15:42:10 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6960