File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -370,6 +370,17 @@ the :class:`Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface` i
370
370
public function warmUp($cacheDirectory)
371
371
{
372
372
// ... do some sort of operations to "warm" your cache
373
+
374
+ // this method must return an array with the file paths of the
375
+ // PHP files to preload. If you don't have any, return an empty array
376
+ $filesToPreload = [];
377
+ foreach (scandir($someCacheDir) as $file) {
378
+ if (!is_dir($file = $someCacheDir.'/'.$file)) {
379
+ $filesToPreload[] = $file;
380
+ }
381
+ }
382
+
383
+ return $filesToPreload;
373
384
}
374
385
375
386
public function isOptional()
@@ -378,6 +389,11 @@ the :class:`Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface` i
378
389
}
379
390
}
380
391
392
+ .. deprecated :: 5.1
393
+
394
+ Not returning an array from the ``warmUp() `` method with the files to
395
+ preload is deprecated since Symfony 5.1.
396
+
381
397
The ``isOptional() `` method should return true if it's possible to use the
382
398
application without calling this cache warmer. In Symfony, optional warmers
383
399
are always executed by default (you can change this by using the
You can’t perform that action at this time.
0 commit comments