Sylius/SyliusResourceBundle

Call to a member function implementsInterface() on null

vvasiloi opened this issue · 0 comments

Description

bin/console doctrine:mapping:convert xml config/doctrine
Symfony\Component\Debug\Exception\FatalThrowableError {#1527
  -originalClassName: "Error"
  #message: "Call to a member function implementsInterface() on null"
  #code: 0
  #file: "vendor/sylius/resource-bundle/src/Bundle/EventListener/AbstractDoctrineSubscriber.php"
  #line: 38
  #severity: E_ERROR
  trace: {
    vendor/sylius/resource-bundle/src/Bundle/EventListener/AbstractDoctrineSubscriber.php:38 { …}
    vendor/sylius/resource-bundle/src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php:86 { …}
    vendor/sylius/resource-bundle/src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php:40 { …}
    vendor/symfony/doctrine-bridge/ContainerAwareEventManager.php:58 { …}
    vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:242 { …}
    vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:306 { …}
    vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78 { …}
    vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:193 { …}
    vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:91 { …}
    vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Console/Command/ConvertMappingCommand.php:113 { …}
    vendor/doctrine/doctrine-bundle/Command/Proxy/ConvertMappingDoctrineCommand.php:37 { …}
    vendor/symfony/console/Command/Command.php:255 { …}
    vendor/symfony/console/Application.php:1019 { …}
    vendor/symfony/framework-bundle/Console/Application.php:97 { …}
    vendor/symfony/console/Application.php:271 { …}
    vendor/symfony/framework-bundle/Console/Application.php:83 { …}
    vendor/symfony/console/Application.php:147 { …}
    bin/console:38 {
      › $application = new Application($kernel);
      › $application->run($input);
      › 
      arguments: {
        $input: Symfony\Component\Console\Input\ArgvInput {#4 …}
      }
    }
  }
}

return $metadata->getReflectionClass()->implementsInterface(ResourceInterface::class);

Steps to reproduce
Run bin/console doctrine:mapping:convert xml config/doctrine in a Sylius Standard application

Possible Solution
Add this line

$parentMetadata->wakeupReflection($this->getReflectionService());
to
private function unsetAssociationMappings(ClassMetadataInfo $metadata): void
{
/** @psalm-suppress InvalidArgument */
if (false === $this->isResource($metadata)) {