Open denissolomkin opened 4 years ago
Does this also affect 2.6.x?
Yes, for 2.6.3 is actual too
I also have this issue on 2.7.0
./bin/console doctrine:mapping:convert xml ./config/doctrine
In ClassMetadataInfo.php line 3328:
Notice: Trying to get property 'name' of non-object
I upgraded my projects to Symfony 5, which give me the following deprecation warnings:
YAML mapping driver is deprecated and will be removed in Doctrine ORM 3.0, please migrate to annotation or XML driver.
More people willl probably encounter this issue as soon as they start upgrading to Symfony 5 en start fixing their deprecation warnings.
For anybody encountering this same issue after upgrading to ORM 2.7.0, this worked for me:
Open vendor/doctrine/orm/lib/Doctrine/ORM/Tools/DisconnectedClassMetadataFactory.php
and remove:
/**
* @return \Doctrine\Common\Persistence\Mapping\StaticReflectionService
*/
public function getReflectionService()
{
return new StaticReflectionService();
}
Run the command. Only downside is that you'll have to manually fix all the embeddables as the converter doesn't support that correctly.
Bug Report
Commands using DisconnectedClassMetadataFactory fails with embedded type without columnPrefix. Actual for commands: GenerateEntitiesCommand, ConvertMappingCommand, ImportMappingDoctrineCommand
Summary
Fails in commands, like as
doctrine:mapping:convert
, which using DisconnectedClassMetadataFactory (it always returns StaticReflectionService with dummypublic function getClass($class) { return null; }
), when Entity has embedded field without prefixColumn (if you want use fully auto-generated column name), because reflection is not object\Doctrine\ORM\Mapping\ClassMetadataInfo:
Current behavior
How to reproduce
Add:
Run:
php bin/console doctrine:mapping:convert yml folder-to-dist
How to reproduce
Command execution without exception