api-platform / core

The server component of API Platform: hypermedia and GraphQL APIs in minutes
https://api-platform.com
MIT License
2.38k stars 846 forks source link

Implement getType for ODM DoctrineExtractor #6417

Closed yunicot closed 3 weeks ago

yunicot commented 3 weeks ago

API Platform version(s) affected: 3.3.5

Description
After upgrade symfony 6.4 -> 7.1 I cannot make cache:clear I have next exception:

[Symfony\Component\ErrorHandler\Error\UndefinedMethodError]                                                                
  Attempted to call an undefined method named "getType" of class "ApiPlatform\Doctrine\Odm\PropertyInfo\DoctrineExtractor".  
  Did you mean to call "getTypes"?

After research I found that PropertyInfoLoader::getPropertyTypes() is using getType instead of getTypes from symfony 7.1 if the method PropertyInfoExtractor::getType() exists

How to reproduce
Install api platform with symfony/property-info ^7.1 (with ODM)

Possible Solution
Implement the ApiPlatform\Doctrine\Odm\PropertyInfo\DoctrineExtractor::getType()

soyuka commented 3 weeks ago

451d50e538a4f7aac67d47601fee5474af99c870 this will be fixed in the next release, symfony 7.1 just came out...