Skip to content

Commit cecd771

Browse files
authoredOct 25, 2024··
feat(laravel): use laravel cache setting (#6751)
Closes: #6735
1 parent ac6f667 commit cecd771

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed
 

‎src/Laravel/ApiPlatformProvider.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public function register(): void
297297
});
298298

299299
$this->app->extend(PropertyMetadataFactoryInterface::class, function (PropertyInfoPropertyMetadataFactory $inner, Application $app) {
300-
/** @var ConfigRepository */
300+
/** @var ConfigRepository $config */
301301
$config = $app['config'];
302302

303303
return new CachePropertyMetadataFactory(
@@ -313,12 +313,12 @@ public function register(): void
313313
$app->make(ResourceClassResolverInterface::class)
314314
),
315315
),
316-
true === $config->get('app.debug') ? 'array' : 'file'
316+
true === $config->get('app.debug') ? 'array' : $config->get('cache.default', 'file')
317317
);
318318
});
319319

320320
$this->app->singleton(PropertyNameCollectionFactoryInterface::class, function (Application $app) {
321-
/** @var ConfigRepository */
321+
/** @var ConfigRepository $config */
322322
$config = $app['config'];
323323

324324
return new CachePropertyNameCollectionMetadataFactory(
@@ -331,7 +331,7 @@ public function register(): void
331331
)
332332
)
333333
),
334-
true === $config->get('app.debug') ? 'array' : 'file'
334+
true === $config->get('app.debug') ? 'array' : $config->get('cache.default', 'file')
335335
);
336336
});
337337

@@ -345,7 +345,7 @@ public function register(): void
345345

346346
// TODO: add cached metadata factories
347347
$this->app->singleton(ResourceMetadataCollectionFactoryInterface::class, function (Application $app) {
348-
/** @var ConfigRepository */
348+
/** @var ConfigRepository $config */
349349
$config = $app['config'];
350350
$formats = $config->get('api-platform.formats');
351351

@@ -401,7 +401,7 @@ public function register(): void
401401
$app->make('filters')
402402
)
403403
),
404-
true === $config->get('app.debug') ? 'array' : 'file'
404+
true === $config->get('app.debug') ? 'array' : $config->get('cache.default', 'file')
405405
);
406406
});
407407

‎src/Laravel/workbench/app/Providers/WorkbenchServiceProvider.php

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function register(): void
3232
{
3333
$config = $this->app['config'];
3434
$config->set('api-platform.resources', [app_path('Models'), app_path('ApiResource')]);
35+
$config->set('cache.default', 'null');
3536
}
3637

3738
/**

0 commit comments

Comments
 (0)
Please sign in to comment.