|
86 | 86 | use ApiPlatform\Laravel\Eloquent\Metadata\ModelMetadata; |
87 | 87 | use ApiPlatform\Laravel\Eloquent\Metadata\ResourceClassResolver as EloquentResourceClassResolver; |
88 | 88 | use ApiPlatform\Laravel\Eloquent\PropertyAccess\PropertyAccessor as EloquentPropertyAccessor; |
| 89 | +use ApiPlatform\Laravel\Eloquent\PropertyInfo\EloquentExtractor; |
89 | 90 | use ApiPlatform\Laravel\Eloquent\Serializer\SerializerContextBuilder as EloquentSerializerContextBuilder; |
90 | 91 | use ApiPlatform\Laravel\GraphQl\Controller\EntrypointController as GraphQlEntrypointController; |
91 | 92 | use ApiPlatform\Laravel\GraphQl\Controller\GraphiQlController; |
@@ -195,15 +196,16 @@ public function register(): void |
195 | 196 | { |
196 | 197 | $this->mergeConfigFrom(__DIR__.'/config/api-platform.php', 'api-platform'); |
197 | 198 |
|
198 | | - $this->app->singleton(PropertyInfoExtractorInterface::class, function () { |
| 199 | + $this->app->singleton(PropertyInfoExtractorInterface::class, function (Application $app) { |
199 | 200 | $phpstanExtractor = class_exists(PhpDocParser::class) ? new PhpStanExtractor() : null; |
200 | 201 | $reflectionExtractor = new ReflectionExtractor(); |
| 202 | + $eloquentExtractor = new EloquentExtractor($app->make(ModelMetadata::class)); |
201 | 203 |
|
202 | 204 | return new PropertyInfoExtractor( |
203 | 205 | [$reflectionExtractor], |
204 | 206 | $phpstanExtractor ? [$phpstanExtractor, $reflectionExtractor] : [$reflectionExtractor], |
205 | 207 | [], |
206 | | - [$reflectionExtractor], |
| 208 | + [$eloquentExtractor], |
207 | 209 | [$reflectionExtractor] |
208 | 210 | ); |
209 | 211 | }); |
@@ -262,10 +264,10 @@ public function register(): void |
262 | 264 | return new CachePropertyMetadataFactory( |
263 | 265 | new SchemaPropertyMetadataFactory( |
264 | 266 | $app->make(ResourceClassResolverInterface::class), |
265 | | - new PropertyInfoPropertyMetadataFactory( |
266 | | - $app->make(PropertyInfoExtractorInterface::class), |
267 | | - new SerializerPropertyMetadataFactory( |
268 | | - $app->make(SerializerClassMetadataFactory::class), |
| 267 | + new SerializerPropertyMetadataFactory( |
| 268 | + $app->make(SerializerClassMetadataFactory::class), |
| 269 | + new PropertyInfoPropertyMetadataFactory( |
| 270 | + $app->make(PropertyInfoExtractorInterface::class), |
269 | 271 | new AttributePropertyMetadataFactory( |
270 | 272 | new EloquentAttributePropertyMetadataFactory( |
271 | 273 | new EloquentPropertyMetadataFactory( |
|
0 commit comments